forked from MarkLogicUniversity/Geophoto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
49 lines (40 loc) · 1.64 KB
/
app.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
38
39
40
41
42
43
44
45
46
47
48
49
'use strict';
process.env.NODE_ENV = 'development';
var express = require('express');
var bodyParser = require('body-parser');
var methodOverride = require('method-override');
var path = require('path');
var app = express();
var router = express.Router();
var routes = require('./routes').app;
var apiroutes = require('./routes').api;
app.set('port', 4000);
app.set('view engine', 'jade');
app.use('/components', express.static(__dirname + '/components'));
app.use('/public', express.static(path.normalize(path.join(__dirname, '/public'))));
app.use('/views', express.static(__dirname + '/views'));
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json({extended: true}));
app.use(methodOverride());
if (app.get('env') === 'development') {
app.locals.pretty = true;
}
/*
Basic route configuration
*/
router.route('/').get(routes.index);
router.route('/api/').get(apiroutes.index);
router.route('/api/image/:id').get(apiroutes.image);
router.route('/api/image/search/:radius/:lat/:lng').get(apiroutes.search);
router.route('/api/image/search/:term').get(apiroutes.search);
//router.route('/api/imagedata/:id').get(apiroutes.imagedata);
router.route('/api/image/update/:id/:update').post(apiroutes.update);
router.route('/api/semantic/info/:country').get(apiroutes.semantic);
router.route('/api/:id').get(apiroutes.image);
//route declaration for the partials
router.route('/partials/:name').get(routes.partials);
//route to display images
router.route('/binary/:id').get(apiroutes.imagedata);
app.use('/', router);
app.listen(app.get('port'));
console.log('Magic happens on port ' + app.get('port'));