refactor: app in html
This commit is contained in:
parent
7b69d023e6
commit
8c8c879283
|
@ -1,15 +0,0 @@
|
|||
import express from 'express';
|
||||
|
||||
import userRoutes from './routes/user';
|
||||
import passport from './passport';
|
||||
import session from './session';
|
||||
|
||||
export default function createApp() {
|
||||
const app = express();
|
||||
app.use(express.urlencoded({extended: true}));
|
||||
app.use(session());
|
||||
app.use(passport.initialize());
|
||||
app.use(passport.session());
|
||||
userRoutes(app);
|
||||
return app;
|
||||
}
|
|
@ -1,16 +1,20 @@
|
|||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import express from 'express';
|
||||
import http, {ServerResponse} from 'http';
|
||||
import httpProxy from 'http-proxy';
|
||||
import {join} from 'path';
|
||||
|
||||
import httpProxy from 'http-proxy';
|
||||
|
||||
import createApp from './app';
|
||||
|
||||
let app;
|
||||
import userRoutes from './routes/user';
|
||||
import passport from './passport';
|
||||
import session from './session';
|
||||
|
||||
export function createHttpServer() {
|
||||
app = createApp();
|
||||
const app = express();
|
||||
app.use(express.urlencoded({extended: true}));
|
||||
app.use(session());
|
||||
app.use(passport.initialize());
|
||||
app.use(passport.session());
|
||||
userRoutes(app);
|
||||
const httpServer = http.createServer(app);
|
||||
httpServer.listen(31344, '0.0.0.0');
|
||||
if ('production' !== process.env.NODE_ENV) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user