mirror of
https://github.com/dap-ps/discover.git
synced 2025-02-12 09:17:32 +00:00
24 lines
637 B
JavaScript
24 lines
637 B
JavaScript
const express = require('express');
|
|
|
|
const DAppsRoute = require('./dapps-routes');
|
|
|
|
class APIRouter {
|
|
static route(app) {
|
|
app.use('/metadata', DAppsRoute.build(express));
|
|
|
|
/* for ElasticBeanstalk Load Balancer healthcheck */
|
|
app.use('/healthcheck', async (req, res) => res.send('OK'))
|
|
|
|
/* redirect if not on https on prod */
|
|
app.use(async (req, res, next) => {
|
|
if (req.get('x-forwarded-proto') == 'http') {
|
|
res.redirect('https://' + req.headers.host + req.url);
|
|
} else {
|
|
next()
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
module.exports = APIRouter;
|