forked from eladnava/applicationize
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
32 lines (24 loc) · 731 Bytes
/
Copy pathserver.js
File metadata and controls
32 lines (24 loc) · 731 Bytes
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
var koa = require('koa');
var route = require('koa-route');
var static = require('koa-static');
var body = require('koa-better-body');
// Koa middleware
var https = require('./lib/middleware/https');
var error = require('./lib/middleware/error');
// Create koa app
var app = koa();
// Koa middleware
app.use(error());
app.use(https());
app.use(body());
app.use(static('./public'));
// HTML file aliases
app.use(route.get('/now', require('./lib/routes/now')));
// API routes
app.use(route.post('/applicationize', require('./lib/routes/applicationize')));
// Define configurable port
var port = process.env.PORT || 3000;
// Listen for connections
app.listen(port);
// Log port
console.log('Server listening on port ' + port);