-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
26 lines (20 loc) · 726 Bytes
/
server.js
File metadata and controls
26 lines (20 loc) · 726 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
var express = require('express'),
app = express(),
bodyParser = require('body-parser'),
morgan = require('morgan'),
path = require('path');
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(function(req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST');
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With, content-type, Authorization');
next();
});
app.use(morgan('dev'));
app.use(express.static(__dirname + '/app'));
app.get('*', function(req, res) {
res.sendFile(path.join(__dirname + '/index.html'));
});
app.listen(8080);
console.log('uPloader is running on 8080');