Express

Framework ของ NodeJS ที่สามารถใช้ในการทำ WebService อย่าง REST API

install

npm install express
npm i @types/express --save-dev
#index.ts
import express, { Application, Request, Response } from 'express'
const port = process.env.PORT || 4000
const app: Application = express()
app.get('/', (req: Request, res: Response) => {
    res.send('Hello World!')
})
app.listen(port, () => {
    console.log(`Express server has started on port ${port}`);
});

อ่านเพิ่มเติม

Last updated