Node JS
  • SetUp Node&NVM
  • Folder Structure
  • Setup NodeJS Project
  • Library
    • Awilix
    • Swagger
    • Express
    • Jest
      • Supertest
    • Prettier
    • Eslint & Tslint
      • Tslint & Prettier
      • Tslint Plugin Prettier
      • Config With Airbnb
    • Husky And Friends
    • Sentry
  • INFRASTRUCTURE
    • Docker
      • Docker image
      • Docker container
      • Docker Volume
      • Docker command
      • Docker Compose
      • Problem & Solution
    • SonarQube
      • How to use in Nodejs
    • NGinX
    • ดูเพิ่มเติม
  • Note
    • .env declare type
    • Learn Link
Powered by GitBook
On this page
  1. Library

Express

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

PreviousSwaggerNextJest

Last updated 3 years ago

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}`);
});

Cookbook สอน NodeJS กับ Express Ver. เด็ก Java สู่ NodeJSMedium
อ่านเพิ่มเติม
Logo