Setup TypeScript
Setup TypeScript in Node.js project
Install package
npm i express && npm i -D @types/express
Setup basic server at src/main.ts
import express from 'express'
const app = express()
const PORT = process.env.PORT || 3000
app.listen(PORT, () => {
console.log(`Listening at http://localhost:${PORT}`)
})
app.get('/', (req, res) => {
res.send('Hello World!')
})
Start server
npm run dev