-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathborga-server.js
37 lines (28 loc) · 1.05 KB
/
borga-server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict'
const express = require('express')
const session = require('express-session')
const passport = require('passport')
passport.serializeUser((userInfo, done) => { done(null, userInfo) })
passport.deserializeUser((userInfo, done) => { done(null, userInfo) })
module.exports = function (es_spec, db, docs) {
const gamesData = require('./board-games-data')
const borgaData = require(db)
const borgaServices = require('./borga-services')(gamesData, borgaData(es_spec))
const borgaAPI = require('./borga-web-api')(borgaServices)
const borgaSite = require('./borga-web-site')(borgaServices, docs)
const app = express()
app.use(session({
secret: 'isel-ipw',
resave: false,
saveUninitialized: false
}))
app.use(passport.initialize())
app.use(passport.session())
app.set('view engine', 'hbs')
app.use('/favicon.ico',
express.static('static-files/favicon.ico'))
app.use('/public', express.static('static-files'))
app.use('/api', borgaAPI)
app.use('/', borgaSite)
return app
}