Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// cors
app.use(function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*')
res.header(
'Access-Control-Allow-Headers',
'Origin, X-Requested-With, Content-Type, Accept'
)
next()
})
// Import API Routes
app.use('/', router)
// print all routes
expressListRoutes(router).forEach(p => {
console.log(p.methods.join(','), p.path)
})
// Listen the server
app.listen(port)
// log server start event
console.log(`Server listening on ${host}:${port}`) // eslint-disable-line no-console
}),
controllers.imageController,
)
app.get(
'/' +
thumbsPath(
issuePathSegments,
':size' as ImageSize,
{ source: ':source', path: '*?' },
':use' as ImageThumbnailUse,
),
controllers.imageController,
)
const endpoints = listEndpoints(app)
const rootPath = '/'
app.get(rootPath, (req, res) => {
res.setHeader('Content-Type', 'application/json')
res.send(endpoints)
})
return app
}
function getAppEndpoints (app) {
try {
return listEndpoints(app);
} catch (e) {
return [];
}
}
router.get('/', (req, res) => {
res.json(listEndpoints(router))
})
router.get('/', (req, res) => {
res.json(listEndpoints(router))
})