I realise that this might not be specifically related to feathers-swagger. But we should be able to figure this out together, and add it to this repos installation instructions
Input field in header that allows the user to add a token to be included with every request.
const swagger = require('feathers-swagger');
...
app.use(compress())
.options('*', cors(corsOptions))
.use(cors(corsOptions))
.use(favicon( path.join(app.get('public'), 'favicon.ico') ))
.use('/', serveStatic( app.get('public') ))
.use(bodyParser.json())
.use(bodyParser.urlencoded({ extended: true }))
.configure(hooks())
.configure(swagger({
docsPath: '/docs',
uiIndex: path.join(__dirname, '../docs/docs.html'),
info: {
title: 'Feathers app API server',
description: 'This server allows... '
}
}))
.configure(rest())
.configure(socketio())
.configure(services)
.configure(middleware);
...
module.exports = function() {
const app = this;
const options = {
Model: user,
paginate: {
default: 5,
max: 25
}
};
const Service = service(options);
Service.docs = {
description: 'A service to manage users',
definitions: {
users: {
"type": "object",
"required": [
"email",
"password"
],
"properties": {
"email": {
"type": "string",
"description": "User email"
},
"password": {
"type": "string",
"description": "User Password"
},
"createdAt": {
"type": "string",
"description": "object creation date"
},
"updatedAt": {
"type": "string",
"description": "Last time the object was updated"
}
}
}
}
};
// Initialize our service with any options it requires
app.use('/users', Service);
// Get our initialize service to that we can bind hooks
const userService = app.service('/users');
// Set up our before hooks
userService.before(hooks.before);
// Set up our after hooks
userService.after(hooks.after);
};