-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathserver.js
More file actions
30 lines (27 loc) · 795 Bytes
/
server.js
File metadata and controls
30 lines (27 loc) · 795 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
var express = require('express');
var apiProxy;
if(process.env.NODE_ENV === 'development'){
apiProxy = require('./server/apiProxy');
} else {
apiProxy = require('./build/apiProxy').default;
}
const app = express();
const port = process.env.PORT || 3000;
const public_path = express.static(__dirname + '/public');
const index_path = __dirname + '/public/index.html';
app.use(public_path);
app.use('/api', apiProxy);
const register = (req, res) => {
res.redirect('https://register.hackjunction.com');
}
app.use('/apply', register);
app.use('/register', register);
app.get('*', function(request, response) {
response.sendFile(index_path, function(error) {
if (error) {
console.log(error);
}
});
});
app.listen(port);
console.log('Listening at http://localhost:' + port);