29 September 2019

NodeJS ExpressJS: Hello world example [EX-01]


Javascript Frameworks
ExpressJS, SailsJS, MeteorJS, KoaJS, FeathersJS


https://expressjs.com/
https://expressjs.com/en/starter/hello-world.html

npm init
npm install express --save

Hello world example
app.js
const express = require('express')
const app = express()
const port = 3000

// GET method route
app.get('/', (req, res) => res.send('Hello World!'))

app.listen(port, () => console.log(`Example app listening on port ${port}!`))
Command: node app.js
Url: http://localhost:3000/
Kết quả: Hello World!
Url: http://localhost:3000/users
Kết quả: User list

0 nhận xét:

Post a Comment

 

BACK TO TOP

Xuống cuối trang