Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env copy
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
# chatable-server
# chatable-server
Ethan Pierce
Justin Martin
David Butler

We are making basic live chat app that is able to connect people as well as branch off into different chat rooms.
We are using Github issues for our Kanban and it has many built features we are using for our PR and merge requests including PR approval, who the issue is assigned to, CI restrictions, and ticketing.


Heroku name:
quiet-thicket-46242

Netlify Site:
https://silly-booth-cbd86f.netlify.app
18 changes: 9 additions & 9 deletions lib/controllers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ const UserService = require('../services/UserService');

const attachCookie = (res, user) => {
res.cookie('session', UserService.authToken(user), {
httpOnly: true,
maxAge: 1000 * 60 * 60 * 24,
sameSite: 'none',
secure: process.env.NODE_ENV === 'production'
httpOnly: true,
maxAge: 1000 * 60 * 60 * 24,
sameSite: 'none',
secure: process.env.NODE_ENV === 'production'
});
}
};

module.exports = Router()
.post('/signup', (req, res, next) => {
UserService
UserService
.create(req.body)
.then(user => {
attachCookie(res, user);
res.send(user)
res.send(user);
})
.catch(next);
})
Expand All @@ -27,12 +27,12 @@ module.exports = Router()
.authorize(req.body)
.then(user => {
attachCookie(res, user);
res.send(user)
res.send(user);
})
.catch(next);
})

.get('/verify', ensureAuth, (req, res) => {
res.send(req.user)
res.send(req.user);
});

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"test": "jest --verbose --runInBand --testLocationInResults --setupFiles dotenv/config",
"test:watch": "npm run test -- --watch",
"start": "node -r dotenv/config server.js",
"start:watch": "nodemon -r dotenv/config server.js"
"start:watch": "nodemon -r dotenv/config server.js",
"setup-db": "npm run recreate-tables && npm run load-seed-data",
"setup-db:prod": "heroku run npm run setup-db",
"setup-heroku": "heroku addons:create heroku-postgresql:hobby-dev && heroku config:set PGSSLMODE=require && heroku config:get DATABASE_URL"
},
"jest": {
"testEnvironment": "node"
Expand Down