Skip to content

Commit

Permalink
random location
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemcdonald committed Mar 20, 2020
1 parent 4018134 commit 0b3f219
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions index.js
Expand Up @@ -52,13 +52,20 @@ app.use(sassMiddleware({

app.use(raven.middleware.express('https://edf1ff6b26ca41b0a9bbb280902b8c4e:e709b93edcdf49aabf54f637c90bf6b0@app.getsentry.com/41348'));

// Add new locations here.
var sites = ['london', 'netherlands', 'birmingham', 'gwangju', 'beijing'];

function randomChoice(array) {
return array[Math.floor(Math.random()*array.length)];
}

app.get('/', function(req, res) {
// To redirect the main page during an exhibition, modify the next line.
res.redirect('/beijing');
// var location = 'beijing';
var location = randomChoice(sites);
res.redirect('/' + location);
});

// Add new locations here.
var sites = ['london', 'netherlands', 'birmingham', 'gwangju', 'beijing'];
sites.forEach(function(site) {
app.get('/' + site, function(req, res) {
returnSite(req,res);
Expand Down

0 comments on commit 0b3f219

Please sign in to comment.