-
Notifications
You must be signed in to change notification settings - Fork 37
/
server.js
44 lines (36 loc) · 1.24 KB
/
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
36
37
38
39
40
41
42
43
44
var pmx = require('pmx'); pmx.init();
var express = require('express')
, http = require('http')
, path = require('path')
, fs = require('fs')
, inspect = require('util').inspect
, logger = require('./lib/logger.js')
;
var app = express();
// all environments
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.set('view options', {pretty: true});
app.set('port', process.env.PORT || 8888);
app.set('title', 'cloudcv.io');
app.use(express.static(path.join(__dirname, 'public')));
// Static pages
app.get('/', function(req, res) { res.render('index'); });
app.get('/about', function(req, res) { res.render('about'); });
app.get('/privacy', function(req, res) { res.render('privacy'); });
app.get('/docs', function(req, res) { res.render('api-docs'); });
// Demo endpoints:
app.all('/demo/analysis', function(req, res) {
res.render('demo-analysis',
{
"example": { "availableImages": [
"/images/lena.png",
"/images/mandrill.png",
"/images/sudoku.png",
"/images/kid.jpg"
] }
});
});
http.createServer(app).listen(app.get('port'), function(){
logger.log("cloudcv.io server listening on port " + app.get('port'));
});