|
|
@ -6,13 +6,23 @@ import passport from './passport'; |
|
|
|
import routes from './routes'; |
|
|
|
import routes from './routes'; |
|
|
|
import { rrouters } from './lib/rrouters'; |
|
|
|
import { rrouters } from './lib/rrouters'; |
|
|
|
import session from './session'; |
|
|
|
import session from './session'; |
|
|
|
|
|
|
|
import { stdout } from './lib/shell'; |
|
|
|
|
|
|
|
|
|
|
|
export default (async () => { |
|
|
|
export default (async () => { |
|
|
|
const app = express(); |
|
|
|
const app = express(); |
|
|
|
|
|
|
|
|
|
|
|
app.use(json()); |
|
|
|
app.use(json()); |
|
|
|
|
|
|
|
|
|
|
|
app.use(cors()); |
|
|
|
app.use( |
|
|
|
|
|
|
|
cors({ |
|
|
|
|
|
|
|
origin: (requestOrigin, done) => { |
|
|
|
|
|
|
|
stdout(`Request header: Origin=${requestOrigin}`); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
done(null, requestOrigin); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
credentials: true, |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Add session handler to the chain **after** adding other handlers that do
|
|
|
|
// Add session handler to the chain **after** adding other handlers that do
|
|
|
|
// not depend on session(s).
|
|
|
|
// not depend on session(s).
|
|
|
|