Created
February 3, 2017 18:27
-
-
Save harrisrobin/d7351dd8896aa70b490435f4c561d11c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
require('dotenv').config({ silent: true }) | |
const path = require('path') | |
const serveStatic = require('feathers').static | |
const favicon = require('serve-favicon') | |
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 swagger = require('feathers-swagger') | |
const seeder = require('feathers-seeder') | |
const Liana = require('forest-express-sequelize') | |
const middleware = require('./middleware') | |
const services = require('./services') | |
const models = require('./models') | |
const app = feathers() | |
app.configure(configuration(path.join(__dirname, '..'))) | |
app.use(compress()) | |
.options('*', cors()) | |
.use(cors()) | |
.use(favicon(path.join(app.get('public'), 'favicon.ico'))) | |
.use('/', serveStatic(app.get('public'))) | |
.use(bodyParser.json()) | |
.use(bodyParser.urlencoded({ extended: true })) | |
.configure(hooks()) | |
.configure(swagger({ | |
docsPath: '/docs', | |
uiIndex: path.join(__dirname, '../', 'public/docs.html'), | |
info: { | |
title: 'Jobbook V3 API documentation', | |
description: 'This is the API documentation' | |
} | |
})) | |
.configure(rest()) | |
.configure(socketio()) | |
.configure(models) | |
.use(Liana.init({ | |
modelsDir: app.get('modelsDir'), // Your models directory. | |
envSecret: process.env.FOREST_ENV_SECRET, | |
authSecret: process.env.FOREST_AUTH_SECRET, | |
sequelize: app.get('sequelize') // The sequelize database connection. | |
})) | |
.configure(services) | |
.configure(middleware) | |
.configure(seeder(require('./utils/seed/options'))) | |
Liana.collection('Jobs', { | |
fields: [{ | |
field: 'location', | |
type: 'String', | |
value: function(object) { | |
console.log('object Liana', object) | |
return object.latitude + ', ' + object.longitude | |
} | |
}] | |
}) | |
module.exports = app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment