forked from CloudSlang/CloudSlang.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
36 lines (29 loc) · 966 Bytes
/
index.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
var http = require('http');
var bodyParser = require('body-parser');
var express = require('express');
var morgan = require('morgan');
var compress = require('compression');
var app = express();
app.use(compress());
app.use(morgan('dev'));
app.use(express.static(__dirname + '/public'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
app.get('/status',function(req, res){
res.send('/status GET OK');
});
app.get('/download',function(req, res){
res.redirect("https://github.com/CloudSlang/cloud-slang/releases/download/cloudslang-0.8.0/cslang-cli-with-content.zip")
});
app.use(function(req, res) {
var err = new Error('Not Found');
err.status = 404;
res.sendFile(__dirname + '/public/404.html')
});
app.set('port', (process.env.PORT || 5000));
// Start the server
http.createServer(app).listen(app.get('port'), function() {
console.log('Express server listening on port: ' + app.get('port'));
});