2017-10-31 13:43:55 +00:00
|
|
|
'use strict'
|
2017-01-11 19:13:38 +00:00
|
|
|
|
2017-10-31 13:43:55 +00:00
|
|
|
const path = require('path')
|
|
|
|
const compress = require('compression')
|
|
|
|
const cors = require('cors')
|
|
|
|
const feathers = require('feathers')
|
|
|
|
const configuration = require('feathers-configuration')
|
|
|
|
const hooks = require('feathers-hooks')
|
|
|
|
const rest = require('feathers-rest')
|
|
|
|
const bodyParser = require('body-parser')
|
|
|
|
const socketio = require('feathers-socketio')
|
|
|
|
const middleware = require('./middleware')
|
|
|
|
const services = require('./services')
|
2017-01-11 19:13:38 +00:00
|
|
|
|
2017-10-31 13:43:55 +00:00
|
|
|
const app = feathers()
|
2017-01-11 19:13:38 +00:00
|
|
|
|
2017-10-31 13:43:55 +00:00
|
|
|
app.configure(configuration(path.join(__dirname, '..')))
|
2017-01-11 19:13:38 +00:00
|
|
|
|
|
|
|
app.use(compress())
|
2017-10-31 13:43:55 +00:00
|
|
|
.options('*', cors())
|
|
|
|
.use(cors())
|
|
|
|
.use(bodyParser.json())
|
|
|
|
.use(bodyParser.urlencoded({ extended: true }))
|
|
|
|
.configure(hooks())
|
|
|
|
.configure(rest())
|
|
|
|
.configure(socketio())
|
|
|
|
.configure(services)
|
|
|
|
.configure(middleware)
|
2017-01-11 19:13:38 +00:00
|
|
|
|
2017-10-31 13:43:55 +00:00
|
|
|
module.exports = app
|