-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
53 lines (46 loc) · 2.3 KB
/
app.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
52
53
// Boilerplate to setup the app
var express = require("express");
var app = express()
var handlebars = require('express-handlebars').create({defaultLayout:'main'});
app.use(express.static('public'));
app.engine('handlebars', handlebars.engine);
app.set('view engine', 'handlebars');
app.set('port', process.env.PORT);
// Render homepage
app.get('/', function(req, res){
res.render('home');
});
// Render classical page
app.get('/classical', function(req, res){
var myContext = {};
myContext.showTimer = true;
myContext.bodyId = "classicalBody";
myContext.buttonId = "classicalButton";
myContext.musicPlayer = '<iframe width="100%" height="300" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/playlists/342371943&color=%23ff5500&auto_play=true&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>'
res.render('classical', myContext);
});
// Render lofi hip-hop page
app.get('/lofi', function(req, res){
var myContext = {};
myContext.showTimer = true;
myContext.bodyId = "lofiBody";
myContext.buttonId = "lofiButton";
myContext.musicPlayer = '<iframe width="100%" height="300" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/playlists/300494469&color=%23ff5500&auto_play=true&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>'
res.render('lofi', myContext);
});
// Render ambient page
app.get('/ambient', function(req, res){
var myContext = {};
myContext.showTimer = true;
myContext.bodyId = "ambientBody";
myContext.buttonId = "ambientButton";
myContext.musicPlayer = '<iframe width="100%" height="300" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/playlists/154856346&color=%23ff5500&auto_play=true&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>'
res.render('ambient', myContext);
});
// Render about page
app.get('/about', function(req, res){
res.render('about');
});
app.listen(app.get('port'), function(){
console.log('Express started on local host!');
});