

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Welcome to Web Servers
incomplete
2: Async TypeScript
incomplete
3: Setup
incomplete
4: Build
incomplete
5: Server
incomplete
6: Fileservers
incomplete
7: Fileserver Quiz
incomplete
8: Serving Images
incomplete
9: Workflow Tips
incomplete
10: Custom Handlers
incomplete
11: Request, Response
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
To kick things off, let's get our TypeScript project started with a classic "Hello, World!" program.
I highly recommend that you create a git repository for Chirpy hosted on GitHub (or whichever host you prefer), then clone the repo down onto your local machine. It's not a requirement, but a best practice. Use Git to save your work as you go.
The npm init command creates a package.json file to track the project's scripts and dependencies. The TypeScript compiler reads tsconfig.json to find the source files in src and compile them into JavaScript files in dist.
Set up a runnable TypeScript project.
npm init -y
npm install -D typescript @types/node
{
"compilerOptions": {
"target": "esnext",
"module": "nodenext",
"rootDir": "./src",
"outDir": "./dist",
"strict": true,
"moduleResolution": "nodenext",
"esModuleInterop": true,
"skipLibCheck": true
},
"include": ["./src/**/*.ts"],
"exclude": ["node_modules"]
}
{
...
"type": "module",
"scripts": {
"build": "npx tsc",
"start": "node dist/index.js",
"dev": "npx tsc && node dist/index.js"
},
...
}
Run and submit the CLI tests from the project root.