Skip to content

Instantly share code, notes, and snippets.

@mguida22

mguida22/index.js

Created Jan 28, 2020
Embed
What would you like to do?
const express = require('express')
const app = express()
const port = 3000
const logger = (req, res, next) => {
const timestamp = new Date()
console.log(`${timestamp} A request was made to: ${req.path}`)
next()
}
app.use(logger)
app.get('/hello', (req, res) => {
res.status(200).send('Hello World.')
})
app.listen(port, () => {
console.log(`express server listening on port ${port}`)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.