Express
Install
sh
pnpm add -D expresssh
pnpm add -D @types/expresssh
pnpm add -D @types/nodesh
pnpm add -D tsxDirectory Structure
.
├── package.json
└── src
└── index.tsjson
{
...
"scripts": {
"dev": "tsx watch src/index.ts"
},
...
}ts
import express from 'express'
const app = express()
const port = 3002
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`Server is running on http://localhost:${port}`)
})sh
pnpm devAccesse Browser
http://localhost:3002/