-
Notifications
You must be signed in to change notification settings - Fork 0
/
web.js
26 lines (23 loc) · 859 Bytes
/
web.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
import express from 'express'
import shrinkRay from 'shrink-ray'
import morgan from 'morgan'
import bodyParser from 'body-parser'
import { serveStatic, cacheControl, strictTransportSecurity, session } from './middleware'
import { root, buoys, favorites, auth } from './routes'
export default (app) => {
// likely our proxy will handle compression, cache-control, etc. these are healthy defaults
const web = express()
web.disable('x-powered-by')
web.use(shrinkRay())
web.use(strictTransportSecurity())
web.use(serveStatic()) // immutable static content
web.use(cacheControl()) // cache control for the rest
web.use(bodyParser.json())
web.use(morgan('dev'))
web.use(session)
web.use('/auth', auth(app))
web.use('/favorites', favorites(app))
web.use('/buoys', buoys(app))
web.use('/*', root(app)) // everything else
return web
}