-
Notifications
You must be signed in to change notification settings - Fork 3
/
server.js
35 lines (26 loc) · 852 Bytes
/
server.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
'use strict';
var express = require('express');
var logger = require('morgan');
var bodyParser = require('body-parser');
var path = require('path');
var api = require('./server/api/api');
var app = express();
app.set('views', path.join(__dirname, '/server/views'));
app.set('view engine', 'jade');
app.use('/assets', express.static(path.join(__dirname, 'public/')));
app.use(logger('dev'));
app.use(bodyParser());
app.get('/partials/:partialPath', function (request, response) {
response.render(path.join('partials/', request.params.partialPath));
});
app.get('/api/v1/properties', function (request, response) {
response.send(
JSON.stringify(
api.properties()));
});
app.get('*', function (request, response) {
response.render('index');
});
var port = 3000;
app.listen(port);
console.log('Listening on port ' + port + '...');