Setting Up Express with TypeScript
This is the free lesson
Next: Routing and Controllers
The rest of this course is part of Pro, together with every other course and the ones added later.
$25 a month billed yearly, or $29 month to month
Until 30 November: $210 for the first year, or $14.50 for the first month, with code LAUNCH.
A free account keeps your progress across devices. The paid lessons need Pro.
Code Snippets
Initialize projectbash
mkdir my-api && cd my-api
npm init -y
npm install express
npm install -D typescript @types/express @types/node tsxBasic servertypescript
import express from 'express';
const app = express();
app.use(express.json());
app.get('/health', (req, res) => {
res.json({ status: 'ok' });
});
app.listen(3000, () => {
console.log('Server running on port 3000');
});Let's start by setting up our Express project with TypeScript...