The server
app is nothing more than a normal TypeScript project built on top of node:http
.
It contains a single src
folder with the main entry point main.ts
. The only configuration file necessary at this point is tsconfig.json
.
You can generate a
tsconfig.json
file using TSConfig Guide.
The server is executed using tsx
:
tsx
allows running TypeScript files directly with nodejs.
pnpm add -D tsx
The initial scripts
configuration in package.json
contains the typecheck
command and dev
to execute tsx
in watch mode:
package.json
"scripts": {
"dev": "tsx watch src/main.ts",
"typecheck": "tsc"
}