Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const server = await new Hapi.Server({
port,
cache: [
{
provider: {
constructor: require('catbox-memory'),
options: {
partition: 'cache'
}
},
name: 'memCache'
}
],
routes: {
validate: {
options: ErrorHandler.validateRoutes(),
failAction: async (request, h, err) => {
throw ErrorHandler.Factory.reformatFSPIOPError(err, ErrorHandler.Enums.FSPIOPErrorCodes.MALFORMED_SYNTAX)
}
}
}
})
server.method({
name: 'enums',
method: getEnums,
options: {
cache: {
cache: 'memCache',
expiresIn: 5 * 60 * 1000,
generateTimeout: 30 * 1000
}
}