Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Register Node.js middleware
// -----------------------------------------------------------------------------
app.use(express.static(path.resolve(__dirname, 'public')));
app.use(cookieParser());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(cors());
app.use(fileUpload());
//
// Authentication
// -----------------------------------------------------------------------------
app.use(session({ secret: 'grant' }));
app.use(
grant({
...config.grant,
}),
);
if (__DEV__) {
app.enable('trust proxy');
}
app.post('/token', async (req, res) => {
const authResponse = await auth(req.body);
res.json({ Response: authResponse });
});
//
// Events API
//--------------------------------------------
Meteor.startup(() => {
const config = generateConfig();
grant = new Grant(config);
});