Setup Express project
9 October 2023 (Updated 9 October 2023)
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
Tagged:
Express.js
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment