diff --git a/.gitignore b/.gitignore index cf66dcd..b27b194 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,9 @@ node_modules/ .env nohup.out -logfile \ No newline at end of file +logfile +/redis-stable +redis-stable.tar.gz +tester.psql +.DS_Store +config.js \ No newline at end of file diff --git a/README.md b/README.md index 23aa312..0d81bd0 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Steps for reinstallation / running on a new machine: ---------------------------------- References: -Understanding Google Maps API +Understanding Google Maps API LINKS USED: * https://developers.google.com/maps/documentation/javascript/adding-a-google-map @@ -66,6 +66,18 @@ because i had no idea what to do 90% of the time LINKS USED: * https://www.w3schools.com/js/js_cookies.asp + Resources for refactoring + LINKS USED: +* https://node-postgres.com/guides/project-structure +* https://blog.logrocket.com/setting-up-a-restful-api-with-node-js-and-postgresql-d96d6fc892d8/ + + Security stuff: + LINKS USED: +* Bcrypt https://www.npmjs.com/package/bcrypt + + + + Other things I learned * run ```ps aux | grep node``` to kill ports when the same port error comes up * working on a new branch diff --git a/app.js b/app.js index f0584e4..e92886b 100644 --- a/app.js +++ b/app.js @@ -5,163 +5,14 @@ const env = require('dotenv').config(); var bodyParser = require('body-parser'); const path = require('path'); //this helps the google maps api show up const db = require('./db'); - -////////////for login session////////// -const redis = require('redis'); -const redisStore = require('connect-redis')(session); -const client = redis.createClient(); -var parseurl = require('parseurl') - -//////////url parsing////////// -const http = require('http'); -const url = require('url'); -///////cookies for sessions//////// -var cookieParser = require('cookie-parser'); -////////////////////////////// - const app = express(); -app.use(bodyParser.json()); // support json encoded bodies -app.use(bodyParser.urlencoded({ extended: false })); // support encoded bodies -app.use(cookieParser()); -mountRoutes(app) - -app.use(session({ - secret: 'ssshhhhh', - // create new redis store. - store: new redisStore({ host: 'localhost', port: 6379, client: client,ttl : 260}), - saveUninitialized: false, - resave: true //originally F but unsure -})); +mountRoutes(app) //this helps generate the map app.get('/', (req, res) => { res.sendFile(path.join(__dirname + '/resources/html/map.html')); }); -//no use for admin page .. YET -app.get('/admin',(req,res) => { - if(req.session.email) { - res.write(`