Skip to content

Commit

Permalink
Fix api https
Browse files Browse the repository at this point in the history
  • Loading branch information
drifterz28 committed Sep 28, 2019
1 parent 934f5e6 commit ab935be
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function requireHTTPS(req, res, next) {
return res.redirect('https://' + req.get('host') + req.url);
}
next();
}
};

app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
Expand All @@ -34,11 +34,7 @@ app.use((req, res, next) => {
'Origin, X-Requested-With, Content-Type, Accept'
);
next();
})

app.use(express.static('dist', {
maxAge: 86400
}), requireHTTPS);
});

app.get('/test', (req, res) => {
res.send('Hello World!');
Expand Down Expand Up @@ -70,6 +66,10 @@ app.post('/api/build', (req, res) => {
gitBuild(req, res);
});

app.use(express.static('dist', {
maxAge: 86400
}), requireHTTPS);

if(!isProduction) {
app.get('/', bundler.middleware());
}
Expand Down

0 comments on commit ab935be

Please sign in to comment.