-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
138 lines (114 loc) · 4.49 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// Initializing Server
var express = require('express');
var app = express();
var path = require('path'); // Using path module to easily serve static files and favicon
// Setting up Templating Engine
var engines = require('consolidate');
app.engine('html', engines.hogan); // Tell Express to run .html files through Hogan
app.set('views', __dirname + '/views'); // Tell Express where to find templates
// Setting up static files and favicon
app.use(express.static(path.join(__dirname, 'public'))); // Tell Express where to find static JS and CSS files
app.use(express.favicon(path.join(__dirname, 'public/images/favicon.ico'))); // Tell Express where to find favicon
app.use(express.bodyParser());
// GET request for Framework Page
app.get('/framework', function(request, response) {
console.log('GET request for page_framework.html');
response.render('page_framework.html');
})
// GET request for Login Page
app.get('/login', function(request, response) {
console.log('GET request for login.html');
response.render('login.html');
});
// GET request for Newsfeed
app.get('/newsfeed', function(request, response) {
console.log('GET request for newsfeed.html');
response.render('newsfeed.html');
});
// GET request for Profile about page
app.get('/:id/profile/feed', function(request, response) {
console.log('GET request for profile.html');
response.render('profile.html', {type:"feed",user_id:request.params.id});
});
// GET request for Profile about page
app.get('/:id/profile/about', function(request, response) {
console.log('GET request for profile.html');
response.render('profile.html', {type:"about",user_id:request.params.id});
});
// GET request for other user's Profile
app.get('/:id/profile', function(request, response) {
console.log('GET request for profile.html');
response.render('profile.html', {user_id:request.params.id});
});
// GET request for Search
app.get('/search', function(request, response) {
console.log('GET request for search.html');
response.render('search.html');
});
// GET request for Status
app.get('/status', function(request, response) {
console.log('GET request for status.html');
response.render('status.html');
});
// GET request for Notifications
app.get('/notifications', function(request, response) {
console.log('GET request for notifications.html');
response.render('notifications.html');
});
// GET request for Messaging
app.get('/messaging', function(request, response) {
console.log('GET request for messaging.html');
response.render('messaging.html');
});
// GET request for pictures
app.get('/:id/photos/photos', function(request, response) {
console.log('GET request for photos.html');
response.render('photos.html', {page:"photos",user_id:request.params.id});
});
// GET request for pictures
app.get('/:id/photos/photos_tagged', function(request, response) {
console.log('GET request for photos.html');
response.render('photos.html', {page:"photos_tagged", id:"undefined",user_id:request.params.id});
});
// GET request for albums
app.get('/:id/photos/albums/:album_id', function(request, response) {
console.log('GET request for photos.html');
response.render('photos.html', {page:"albums", id:request.params.album_id, user_id:request.params.id});
});
// GET request for pictures
app.get('/:id/photos/albums', function(request, response) {
console.log('GET request for photos.html');
response.render('photos.html', {page:"albums", user_id:request.params.id});
});
// GET request for pictures
app.get('/:id/photos', function(request, response) {
console.log('GET request for photos.html');
response.render('photos.html', {page:"home", user_id:request.params.id});
});
// GET request for keyboard_demo
app.get('/keyboard_demo', function(request, response) {
console.log('GET request for keyboard_demo.html');
response.render('keyboard_demo.html');
});
// GET request for keyboard
app.get('/keyboard', function(request, response) {
console.log('GET request for keyboard.html');
response.render('keyboard.html');
});
// GET request for thankyou
app.get('/thankyou', function(request, response) {
console.log('GET request for thankyou.html');
response.render('thankyou.html');
});
// GET request for Home Page
app.get('/', function(request, response) {
console.log('GET request for index.html');
response.render('index.html');
});
app.listen(process.env.PORT || 5000, function() {
if(process.env.PORT) {
console.log('HEROKU: Accessible Facebook UI listening on Port ' + process.env.PORT + '...');
} else {
console.log('Accessible Facebook UI listening on Port 5000...')
}
});