diff --git a/.eslintrc.js b/.eslintrc.js index 34e16bfb..35c035ea 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,7 +1,7 @@ -module.exports = { - "extends": "standard", - "rules": { - "semi": [2, "always"], - "indent": "off" - } -}; +// module.exports = { +// "extends": "standard", +// "rules": { +// "semi": [2, "always"], +// "indent": "off" +// } +// }; diff --git a/app.js b/app.js index 792cb36a..f7e26ba8 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,6 @@ const express = require('express'); -const app = express() -const fs = require('fs') +const app = express(); +const fs = require('fs'); const bookingsFile = './client/Data/bookings.json'; const currentFilmsFile = './client/Data/currentFilms.json'; @@ -18,42 +18,42 @@ const upcomingFilms = require(upcomingFilmsFile); app.get('/currentFilms', function (req, resp) { resp.send(currentFilms); -}) +}); app.get('/upcomingFilms', function (req, resp) { resp.send(upcomingFilms); -}) +}); app.get('/reruns', function (req, resp) { resp.send(reruns); -}) +}); app.get('/filmNames', function (req, resp) { var filmNameArray = []; var currentFilmKeys = Object.keys(currentFilms); currentFilmKeys.forEach(function (x) { filmNameArray.push([currentFilms[x][0], x]); - }) + }); var upComingFilmKeys = Object.keys(upcomingFilms); upComingFilmKeys.forEach(function (x) { filmNameArray.push([upcomingFilms[x][0], x]); - }) + }); var rerunsFilmKeys = Object.keys(reruns); rerunsFilmKeys.forEach(function (x) { filmNameArray.push([reruns[x][0], x]); - }) + }); resp.send(filmNameArray); -}) +}); // For the search bar app.get('/Bookings/:email', function (req,resp) { const email = req.params.email; - const bookingEmails = Object.keys(bookings); + const bookingEmails = Object.keys(bookings); try { - result = bookings[email] - } catch(err) {result = ['False']} + result = bookings[email]; + } catch(err) {result = ['False']}; resp.send(result); }) @@ -70,7 +70,7 @@ app.post('/Bookings/MakeABooking', function (req, resp) { var value = [date, film, filmTime, noOfAdults, noOfChildren, firstName, surname] bookings[userEmail] = value; fs.writeFileSync(bookingsFile, JSON.stringify(bookings)); - resp.send(value) + resp.send(value); }) -module.exports = app; \ No newline at end of file +module.exports = app; diff --git a/client/Data/bookings.json b/client/Data/bookings.json index a5ff7018..62953b5f 100644 --- a/client/Data/bookings.json +++ b/client/Data/bookings.json @@ -1 +1 @@ -{"test@durham.ac.uk":["2023-01-28","Transformers: Rise of the Beasts","10.00AM","1","0","Billy","Stapleton"]} \ No newline at end of file +{"test@durham.ac.uk":["2023-01-28","Transformers: Rise of the Beasts","10.00AM","1","0","Billy","Stapleton"],"test2@durham.ac.uk":["2023-01-24","SMATSV","screen1",1,1,"Billy","Stapleton"]} \ No newline at end of file