-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.coffee
43 lines (34 loc) · 1.19 KB
/
app.coffee
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
38
39
40
41
42
43
# Enables coffee script
require 'coffee-script/register'
path = require 'path'
favicon = require 'static-favicon'
logger = require 'morgan'
restify = require 'restify'
pjson = require path.join __dirname, 'package.json'
server = restify.createServer
name: pjson.name
version: pjson.version
server.use restify.acceptParser server.acceptable
server.use restify.queryParser()
server.use restify.bodyParser()
server.use favicon()
server.use logger 'dev'
module.exports = server
# Init db connection and models
require path.join __dirname, 'configs', 'mongoose'
# Load routes
apiRoutes = require path.join __dirname, 'routes', 'api_poi'
server.get '/pois/types', apiRoutes.findTypes
server.get '/pois/categories', apiRoutes.findCategories
server.get '/pois', apiRoutes.find
importRoutes = require path.join __dirname, 'routes', 'import'
server.get '/import/full', importRoutes.fullImport
server.post '/import/json', importRoutes.importJSON
server.post '/import/gpx', importRoutes.importGPX
server.post '/import/kml', importRoutes.importKML
require path.join __dirname, 'routes', 'angular'
# Should be declared after restify roots (why ?)
server.use(require('node-compass')(
mode: 'expanded',
css: 'css'
))