Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
},
/* security: { - use if route is protected
apiKeyHeader: [],
}, */
summary: 'Get users list',
})
private async getUsers(
request: express.Request,
response: express.Response
): Promise {
const users = await UserModel.find({}).exec();
response.status(200).json(users);
}
@ApiOperationPost({
description: 'Post user object',
parameters: {
body: {
description: 'New user',
model: 'User',
required: true,
},
},
responses: {
200: {
model: 'User',
},
400: { description: 'Parameters fail' },
},
/* security: { - use if route is protected
apiKeyHeader: [],
},
},
security: {
apiKeyHeader: [],
},
})
@httpGet('/')
public getCars(
request: express.Request,
response: express.Response,
next: express.NextFunction
): void {
response.json(this.carsService.getCars());
}
@ApiOperationPost({
description: 'Post car object',
summary: 'Post new car',
parameters: {
body: {
description: 'New car',
required: true,
model: 'Car',
},
},
responses: {
200: {
model: 'Car',
},
400: { description: 'Parameters fail' },
},
})