|
|
@ -1,7 +1,20 @@
|
|
|
|
|
|
|
|
import http from 'http';
|
|
|
|
import express, { Request, Response } from 'express';
|
|
|
|
import express, { Request, Response } from 'express';
|
|
|
|
|
|
|
|
import bodyParser from 'body-parser'
|
|
|
|
|
|
|
|
import cookieParser from 'cookie-parser'
|
|
|
|
|
|
|
|
// import passport from 'passport';
|
|
|
|
import register from '@react-ssr/express/register';
|
|
|
|
import register from '@react-ssr/express/register';
|
|
|
|
|
|
|
|
|
|
|
|
const app = express();
|
|
|
|
const app = express();
|
|
|
|
|
|
|
|
app.set('trust proxy', 1);
|
|
|
|
|
|
|
|
const server = http.createServer(app);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.use(bodyParser.json());
|
|
|
|
|
|
|
|
app.use(bodyParser.urlencoded({ extended: false }));
|
|
|
|
|
|
|
|
app.use(cookieParser());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// initPassport();
|
|
|
|
|
|
|
|
// app.use(passport.initialize());
|
|
|
|
|
|
|
|
|
|
|
|
(async () => {
|
|
|
|
(async () => {
|
|
|
|
await register(app);
|
|
|
|
await register(app);
|
|
|
@ -11,7 +24,7 @@ const app = express();
|
|
|
|
res.render('index', { user });
|
|
|
|
res.render('index', { user });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
app.listen(3000, () => {
|
|
|
|
server.listen(3000, () => {
|
|
|
|
console.log('> Ready on http://localhost:3000');
|
|
|
|
console.log('> Ready on http://localhost:3000');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})();
|
|
|
|
})();
|
|
|
|