-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started
Sad Gabi edited this page Jul 23, 2026
·
2 revisions
my-app/
├── src/
│ ├── lib/
│ │ ├── css/
│ │ └── html/
│ ├── static/
│ ├── styles/
│ ├── routes/
│ └── index.html
├── chocola.config.json
├── chocola.server.js
└── index.js
npm install chocola{
"bundle": {
"srcDir": "/src",
"outDir": "/dist",
"libDir": "/lib",
"emptyOutDir": true,
"assetImport": "static"
},
"dev": {
"hostname": "localhost",
"port": 3000
}
}DEPRECATION WARNING:
assetImportalso accepts the"legacy"value, an assets system that imports assets based onsrcandhrefHTML attributes andurl()CSS functions. You may find this system inefficient and buggy in some cases. It will be removed in V2.
// index.js
import { app } from "chocola";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
app.build(__dirname);// chocola.server.js
import { dev } from "chocola";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
dev.server(__dirname);Write something in your src/index.html index page. Remember to include an <app> element — that's where Chocola applies its magic.
<!-- index.html -->
<html>
<head>
<title>My Chocola App</title>
</head>
<body>
<app>
Hello World!
</app>
</body>
</html>Now you're all set! Run node chocola.server.js to see your app in the browser.
Next: Fundamentals
Previus: Overview