Express - Node.js web application framework
app.get('/', function (req, res) {
res.send('Hello World!')
})
app.get('/', function (req, res) {
res.send('Hello World!')
})
app.put('/user', function (req, res) {
res.send('Got a PUT request at /user')
})
app.delete('/user', function (req, res) {
res.send('Got a DELETE request at /user')
})
Serving static files in Express
app.use(express.static('public'))
app.use(express.static('public'))
app.use(express.static('files'))
app.use('/static', express.static('public'))
const path = require('path')
app.use('/static', express.static(path.join(__dirname, 'public')))