-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
51 lines (42 loc) · 1.24 KB
/
server.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// init project
var express = require('express');
var app = express();
var sassMiddleware = require('node-sass-middleware');
// var postcssMiddleware = require('postcss-middleware');
// var autoprefixer = require('autoprefixer');
var path = require('path');
var src = __dirname + '/public';
var dest = '/tmp';
app.use(sassMiddleware({
src: src,
dest: dest,
response: false
}));
// app.use(postcssMiddleware({
// plugins: [
// /* Plugins */
// autoprefixer({
// /* Options */
// })
// ],
// src: function(request) {
// return path.join(dest, request.url);
// }
// }));
// http://expressjs.com/en/starter/static-files.html
app.use(express.static('public'));
app.use(express.static('/tmp'));
// http://expressjs.com/en/starter/basic-routing.html
app.get('/', function (request, response) {
response.sendFile(__dirname + '/views/index.html');
});
app.get('/r/:subreddit', function (request, response) {
response.sendFile(__dirname + '/views/player.html');
});
app.get('/about', function (request, response) {
response.send('you know what I\'m about dawg');
});
// listen for requests :)
let listener = app.listen(process.env.PORT, function () {
console.log('Your app is listening on port ' + listener.address().port);
});