const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})
2.node app.js
명령어를 터미널에 입력한다.
3.localhost:3000
을 클릭
app.get('/hello', (req, res) => {
res.send('Hello World!')
})
만약 위와 같이 get
의 endpoint
에 /hello
를 입력하지 않는이상 아래와 같이 페이지가 뜬다.