Skip to content

Commit

Permalink
Huge fucking refactor in two entities almost done
Browse files Browse the repository at this point in the history
  • Loading branch information
maximelovino committed Nov 27, 2017
1 parent f62a96c commit bc4de38
Show file tree
Hide file tree
Showing 27 changed files with 96 additions and 3,649 deletions.
1 change: 1 addition & 0 deletions .gitignore → client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules/
*.env
.vscode/
doc/
package-lock.json
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "festiv.al-client",
"version": "1.0.0",
"description": "An app to search music concerts and festivals around you",
"main": "start.js",
"scripts": {
"start": "nodemon start.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/maximelovino/festiv.al.git"
},
"author": "Maxime Lovino and Thomas Ibanez",
"license": "ISC",
"bugs": {
"url": "https://github.com/maximelovino/festiv.al/issues"
},
"homepage": "https://github.com/maximelovino/festiv.al#readme",
"dependencies": {
"express": "^4.16.2",
"material-components-web": "^0.24.0",
"nodemon": "^1.12.1",
"pug": "^2.0.0-rc.4",
"request": "^2.83.0"
}
}
32 changes: 32 additions & 0 deletions client/routes/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const express = require('express');
const router = express.Router();
const request = require('request');
const endpointBaseURL = "http:https://localhost:3000";

/**
* Client routes
*/

//Route to get the homepage of the site
router.get('/', (req, res) => {
res.render('home');
});

//Route to get the details page of a specific event
router.get('/events/:id/detail', (req, res) => {
const options = {
method: 'GET',
url: `${endpointBaseURL}/events/${req.params.id}/details`,
}

request(options, (error, response, body) => {
if (!error && response.statusCode == 200) {
const event = JSON.parse(body);
res.render('eventDetail', { event });
} else {
res.sendStatus(404);
}
});
});

module.exports = router;
3 changes: 2 additions & 1 deletion scripts/map.js → client/scripts/map.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
let map;
let markers = [];
const stopButton = document.querySelector('#stopButton');
const baseURL = "http:https://localhost:3000";

stopButton.addEventListener('click', () => {
const previewAudio = document.querySelector('#preview');
Expand Down Expand Up @@ -70,7 +71,7 @@ function mapMoved() {
//1. Query the cache
//2. Query the live data => live data goes in DB as well, so it has to be though server side as well...perhaps use a more representative ID, like a hash of the events data, so we prevent double insertion of same event?
//3. Let our data on map function handle the doubles
const requestURL = `/events/location/${center.lat()}/${center.lng()}/${sw.lat()}/${sw.lng()}/${ne.lat()}/${ne.lng()}`;
const requestURL = `${baseURL}/events/location/${center.lat()}/${center.lng()}/${sw.lat()}/${sw.lng()}/${ne.lat()}/${ne.lng()}`;
const request = new Request(requestURL);
const bar = document.querySelector('#progressBar');
bar.classList.add('mdc-linear-progress--indeterminate');
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions client/start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const app = require('./app');
app.set('port', 80);
const server = app.listen(app.get('port'), () => {
console.log(`Express client running → ADDRESS http:https://localhost:${server.address().port}`);
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit bc4de38

Please sign in to comment.