express-console-logger

1.0.2 • Public • Published

Express-console-logger

Simple and easy to use console logger for HTTP request on Express.js

Installing:

Start by installing express if you do not have it then the logger

$ npm i express
$ npm i express-console-logger

Example

const express = require('express')
const { status_xxx } = require('express-console-logger')
const PORT = 5000

app = express()

app.get('/', (req, res) => {
    res.send('GET')
    status_xxx(req, res)
});

app.post('/', (req, res) => {
    res.send('POST')
    status_xxx(req, res)
});

app.use(function (req, res, next) {
    res.status(404).send('Sorry cant find that!');
    status_xxx(req, res)
});

app.listen(PORT, () => {
    console.log(`Server has started and listening at port ${PORT}`)
});

Output sample:

output

Package Sidebar

Install

npm i express-console-logger

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

127 kB

Total Files

6

Last publish

Collaborators

  • mark62726