Skip to content

Commit

Permalink
Update api.js
Browse files Browse the repository at this point in the history
  • Loading branch information
bkatiemills committed May 6, 2020
1 parent c69b23b commit f3cda54
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bulletin-board-app/backend/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ var db = require('./db.js');
const log = require('log-to-file');

exports.events = function (req, res) {
log('Loading DB events...', '/api.log');
log('Loading DB events...', '/logs/api.log');
db.Events
.findAll()
.then(events => {
log('Fetched events, count: ' + events.length, '/api.log');
log('Fetched events, count: ' + events.length, '/logs/api.log');
res.json(events);
})
.catch(err => {
Expand All @@ -15,7 +15,7 @@ exports.events = function (req, res) {
};

exports.event = function (req, res) {
log('Handling event call, method: ' + req.method + ', event ID: ' + req.params.eventId, '/api.log')
log('Handling event call, method: ' + req.method + ', event ID: ' + req.params.eventId, '/logs/api.log')
switch(req.method) {
case "DELETE":
db.Events
Expand All @@ -24,7 +24,7 @@ exports.event = function (req, res) {
id: req.params.eventId
}
}).then(function() {
log('Deleted event with id: ' + req.params.eventId, '/api.log')
log('Deleted event with id: ' + req.params.eventId, '/logs/api.log')
res.status(200).end();
});
break
Expand Down

0 comments on commit f3cda54

Please sign in to comment.