Swagger, Logger, BodyParser

1-install dependency

npm i feathers-swagger feathers-logger body-parser --save

2- Add to src/app.js

// 1 - Add this requires 
const bodyParser = require('body-parser');
const swagger = require('feathers-swagger');
const feathersLogger = require('feathers-logger');

// const app = express(feathers());
// 2 - add this lines after const app = express(feathers()):

app.configure(feathersLogger(logger));
app.use(bodyParser.json({limit: '10mb'}));
app.use(bodyParser.urlencoded({limit: '10mb', extended: true }));
// Swagger
if(process.env.NODE_ENV !== 'production'){
  app.configure(swagger({
    docsPath: '/docs',
    uiIndex: true, //path.join(__dirname, 'docs.html'),
    info: {
      title: 'feathersjs-server docs',
      description: 'feathersjs-server api'
    }
  }));
}
git add .
git commit -m "add bodyParser to handle files, swagger and feathersLogger"

Last updated