Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
42 lines (33 loc) · 1.04 KB

File metadata and controls

42 lines (33 loc) · 1.04 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
var fs = require('fs');
var koa = require('koa');
var http = require('http');
var https = require('https');
var route = require('koa-route');
var static = require('koa-static');
var body = require('koa-better-body');
// Koa middleware
var error = require('./lib/middleware/error');
var redirect = require('./lib/middleware/redirect');
// Create koa app
var app = koa();
// Koa middleware
app.use(error());
app.use(body());
app.use(redirect());
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 || 8080;
var securePort = process.env.SECURE_PORT || 8443;
// Listen for connections
http.createServer(app.callback()).listen(port);
// HTTPS support
https.createServer({
key: fs.readFileSync('ssl/server.key'),
cert: fs.readFileSync('ssl/server.crt')
}, app.callback()).listen(securePort);
// Log port
console.log('Server listening on port ' + port);
Morty Proxy This is a proxified and sanitized view of the page, visit original site.