A starter template for FaasJS.
- Click
Code->Codespaces->Create codespace on main. - Wait for the codespace to be created.
- In VS Code, open a new terminal and run
ni && nd(shorten command ofnpm install && npm run dev). - Enjoy!
- Latest stable macOS
- Latest stable Docker https://www.docker.com/
- Latest stable Visual Studio Code https://code.visualstudio.com/
- Use VS Code to open project.
- Install VS Code extension:
ms-vscode-remote.vscode-remote-extensionpack. - In VS Code, click
F1then chooseRemote-Containers: Reopen in Container. - In VS Code, open a new terminal
ni && nd(shorten command ofnpm install && npm run dev). - Open
http://localhost:5173/in browser.
Run nt (shorten command of npm run test).
Tests use embedded PGlite in Node test setup, so no external PostgreSQL service is required for local runs.
- Run
nb(shorten command ofnpm run build) to build the frontend by Vite. - Run
nr server(shorten command ofnpm run server) to start the server. - Open
http://localhost:3000/in browser.
FaasJS Starter follows the zero-mapping rule: API file path equals API route path.
- File:
src/pages/todo/api/list.func.ts - Client action:
todo/api/list - Request URL (with
baseUrl: '/pages/'):POST /pages/todo/api/list
Use api/ as the API directory name. Avoid custom rewrites such as actions -> api.
- Run
docker build -t faasjs-starter .to build the Docker image. - Run
docker run -p 3000:3000 faasjs-starterto start the container. - Open
http://localhost:3000/in browser.
Same as preview.