-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
62 lines (48 loc) · 1.42 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
//
// Loading standard modules
//
var express = require('express'),
argv = require('optimist').argv,
url = require('url'),
hbs = require('hbs');
// Loading our code
var app = express(),
opts = {
port: process.env.PORT || 8001
};
//
// Setup
//
app.configure(function() {
app.use(express.cookieParser('clench it'));
app.use(express.bodyParser());
app.use(express.session());
app.use(app.router);
app.set('view engine', 'bars');
app.locals({ settings: { views: "./views/" } });
app.engine('bars', hbs.__express);
app.use(express.static(__dirname + '/public'));
});
//
// Routes
//
app.get('/', function(req, res) {
res.render('index.bars');
});
app.get('/walmartrollbacks-window', function(req, res) {
res.render('walmartproduct.bars');
});
app.get('/walmartrollbacks-redirect', function(req, res) {
res.redirect(302, 'walmart://browse/aHR0cDovL3d3dy53YWxtYXJ0LmNvbS9icm93c2UvcGFydHktb2NjYXNpb25zL2hhbGxvd2Vlbi1pbmZsYXRhYmxlcy8yNjM3XzYxNTc2MF8xMDczNjg0XzEwNzMzMjRfNDMwNzI2Lz9fcmVmaW5lcmVzdWx0PXRydWUmY2F0TmF2SWQ9NjE1NzYwJnBvdmlkPWNhdDYxNTc2MC1lbnY5OTk5OTktbW9kdWxlMDgwNzEyLUxITl9JbmZsYXRhYmxlcw');
});
//
// Starting the server is being run from command line (not via tests)
//
if (!module.parent) {
app.listen(opts.port, function() {
console.log("\nios-url-deeplink is ready to throw some content at devices.\n - listening on port: " + opts.port + "\n");
});
}
//
// Helper Functions
//