Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frani/simple-morgan-res-body
A middleware that made simple to get your res-content-body for your morgan use
https://github.com/frani/simple-morgan-res-body
Last synced: about 1 month ago
JSON representation
A middleware that made simple to get your res-content-body for your morgan use
- Host: GitHub
- URL: https://github.com/frani/simple-morgan-res-body
- Owner: frani
- Created: 2023-02-19T17:26:14.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-19T18:30:35.000Z (almost 2 years ago)
- Last Synced: 2024-12-04T08:04:22.156Z (about 2 months ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# simple-morgan-res-body
A middleware that made simple to get your res-content-body for your morgan use
# Install
using NPM
```
npm install simple-morgan-res-body
```or using yanr
```
yarn add simple-morgan-res-body
```# Usage & Api
```javascript
const express = require('express')
const morgan = require('morgan')
const morgenResBody = require('simple-morgan-res-body')const app = express()
/**
* By default response content is set in res.contentBody
* but you can change it with the key name that you want
*/
app.use(morgenResBody('contentBody'))morgan.token('res-body', (req,res) => res.contentBody)
/**
* Then setup morgan format
*/
app.use(morgan(':res-body'));
```