Quick Start
This is the shortest path to a running KoalaTs application.
Create a project
Use the KoalaTs CLI to generate a new project:
npx @koala-ts/cli create my-app
This command creates a new project in the my-app directory.
Install and run
Move into the project, install dependencies, and start the server:
cd my-app
npm install
npm run start
First endpoint
KoalaTs now prefers function-first route declarations through @koala-ts/framework/routing.
import { create, type HttpScope } from '@koala-ts/framework';
import { Get } from '@koala-ts/framework/routing';
const helloRoute = Get('/', async (scope: HttpScope) => {
scope.response.body = { message: 'Hello KoalaTs' };
});
const app = create({
routes: [helloRoute],
});
app.listen(3000);
What to read next
- Routing to define your first endpoints
- Request and Response to understand the HTTP programming model
- Configuration when you need to tune the app for different environments