|
|
|
@ -1,7 +1,20 @@
|
|
|
|
|
import http from 'http';
|
|
|
|
|
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';
|
|
|
|
|
|
|
|
|
|
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 () => {
|
|
|
|
|
await register(app);
|
|
|
|
@ -10,8 +23,8 @@ const app = express();
|
|
|
|
|
const user = { name: 'World' };
|
|
|
|
|
res.render('index', { user });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
app.listen(3000, () => {
|
|
|
|
|
|
|
|
|
|
server.listen(3000, () => {
|
|
|
|
|
console.log('> Ready on http://localhost:3000');
|
|
|
|
|
});
|
|
|
|
|
})();
|
|
|
|
|