Skip to content

Commit

Permalink
fix Seneca-CDOT#707 add routes - work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Grommers00 committed Feb 13, 2020
1 parent 21f6188 commit 24e37ab
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/backend/web/routes/feeds.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const express = require('express');
const Feed = require('../../data/feed');
const { protect } = require('../authentication');
const { getFeeds } = require('../../utils/storage');
const { logger } = require('../../utils/logger');

Expand Down Expand Up @@ -51,4 +52,19 @@ feeds.get('/:id', async (req, res) => {
}
});

feeds.post('/', protect, async (req, res) => {
const { newFeed, email } = req.body;
try {
/* check if email has a key in redis
if not create key
if user has a key in redis, check if feed already exists, (not sure how fast this is? or if its necessary), if not store feed in feeds.
*/
} catch (error) {
logger.error({ error }, 'Unable to add feed to redis');
res.status(503).json({
message: 'Unable to add feed to database.',
});
}
});

module.exports = feeds;
17 changes: 17 additions & 0 deletions src/backend/web/routes/users.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const express = require('express');

const { logger } = require('../../utils/logger');
const feeds = require('../../data/feeds');
const { getFeeds } = require('../../utils/storage');

const router = express.Router();

router.get('/:id', async (req, res) => {
// this route will return one user, and there list of feeds, this can be utilized in two places. One our search function, and
// two for our add feed component to show a list of feeds that have been attached to the user.
/* this should return
{ id: "some-ud-id, url: "/users/someuserId/ (multiple URLs?)}
*/
});

module.exports = router;

0 comments on commit 24e37ab

Please sign in to comment.