request-seeker
v1.2.4
Published
A express middleware that will help you to log the details of the request that are sent to your express server and also log the response that is sent back to client
Downloads
2
Maintainers
Readme
request-seeker
A express middleware that will help you to log the details of the request that are sent to your express server and also log the response that is sent back to client.
HOW IT IS HELPFUL?
This middleware will help you to log the details of the request that are sent to the server and also the response that is sent to the client.
The log will contain details of:
- ENDPOINT (aka route)
- METHOD (request method)
- BODY (payload that is sent in body of the request)
- QUERY (parameter that sent in query string)
- RESPONSE BODY (the response that is send by that particular route) -- optional
API Explanation
| arg no. | arg | desc | required | |:-------:|:-------:|-------------------------------|:--------:| | 1 | req | | yes | | 2 | res | | yes | | 3 | nxt | | yes | | 4 | options | used for customizing the logs | |
Options
| att | desc | default | |-----------------|--------------------------------------------------|---------| | showResponseLog | print the response that is sent to every request | false | | hideLogo | toggle between showing or hiding the logo | false |
HOW TO USE
.. - normal code
-> - code to add
- Import the middleware
.. var app = express();
-> var requestSeeker = require('request-seeker');
- use it
app.use((req, res, next) => {
requestSeeker(req, res, next, { showResponseLog: true, hideLogo: true })
})
.. app.get('/', (req, res) => {