First steps in integration of IVIS.

This commit is contained in:
Tomas Bures 2018-12-25 20:13:32 +01:00
parent bf626993f4
commit dce5ba7464
35 changed files with 10098 additions and 91 deletions

View file

@ -227,6 +227,11 @@ function createApp(appType) {
app.use(passport.tryAuthByRestrictedAccessToken);
}
if (appType === AppType.TRUSTED || appType === AppType.SANDBOXED) {
// Endpoint under /api are authenticated by access token
app.all('/api/*', passport.authByAccessToken);
}
useWith404Fallback('/static', express.static(path.join(__dirname, '..', 'client', 'static')));
useWith404Fallback('/mailtrain', express.static(path.join(__dirname, '..', 'client', 'dist')));
useWith404Fallback('/locales', express.static(path.join(__dirname, '..', 'client', 'locales')));
@ -239,9 +244,6 @@ function createApp(appType) {
next();
});
// Endpoint under /api are authenticated by access token
app.all('/api/*', passport.authByAccessToken);
// Marks the following endpoint to return JSON object when error occurs
app.all('/api/*', (req, res, next) => {
req.needsAPIJSONResponse = true;