Add OAuth Login facebook,google,github

This commit is contained in:
Qolzam
2017-11-18 19:04:31 +07:00
parent f64b7bb24d
commit 92379b615c
23 changed files with 513 additions and 264 deletions

View File

@@ -1,6 +1,9 @@
var express = require('express');
var morgan = require('morgan');
var path = require('path');
var webpack = require('webpack');
var webpackConfig = require('./webpack.config');
var compiler = webpack(webpackConfig);
// Create our app
var app = express();
@@ -10,18 +13,25 @@ const PORT = process.env.PORT || 3000;
app.use(morgan(':remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length] :response-time ms'));
app.use(function (req, res, next){
if (req.headers['x-forwarded-proto'] === 'https') {
res.redirect('http://' + req.hostname + req.url);
} else {
next();
}
app.use(require("webpack-dev-middleware")(compiler, {
noInfo: true,
publicPath: webpackConfig.output.publicPath
}));
app.use(require("webpack-hot-middleware")(compiler));
app.use(function(req, res, next) {
if (req.headers['x-forwarded-proto'] === 'https') {
res.redirect('http://' + req.hostname + req.url);
} else {
next();
}
});
app.use(function(req, res, next) {
var userAgent = req.get('User-Agent');
console.log(userAgent);
next();
var userAgent = req.get('User-Agent');
console.log(userAgent);
next();
});
app.use(express.static('public'));
@@ -29,11 +39,11 @@ app.use(express.static('public'));
// Always return the main index.html, so react-router render the route in the client
app.get('*', (req, res) => {
res.sendFile(path.resolve('public', 'index.html'));
res.sendFile(path.resolve('public', 'index.html'));
});
app.listen(PORT, function () {
console.log('Express server is up on port ' + PORT);
});
app.listen(PORT, function() {
console.log('Express server is up on port ' + PORT);
});