-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New backend API #9
Conversation
…recated requirement properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking solid, great work @jdtech3. I left a few comments about how we can align with the dependecy injection pattern more closely. The advantage of doing so being that it ensures your objects or functions which want to use a given service do not have to know how to construct those services.
router.get('/', async function(req, res, next) { | ||
let data = await notionService.getRequirementsData(); | ||
let data = await notionService.getRequirements('vis'); | ||
let nodes_json = JSON.stringify(data.nodes); | ||
let edges_json = JSON.stringify(data.edges); | ||
res.render('index', { title: 'TreeVisualizer' , nodes: nodes_json, edges: edges_json}); | ||
}); | ||
|
||
// GET : JSON API | ||
router.get('/api/requirements', async function(req, res, next) { | ||
let data = await notionService.getRequirementsData(); | ||
let data = await notionService.getRequirements('api'); | ||
res.json(data); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the use case for each of these two routes? Do we need both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not, no. Honestly it's probably not great practice, but the legacy demo functionality is serving as an easy sanity test to see whether data is being fetched from the Notion API correctly—JSON is hard to read, but if vis graph generates, data is probably fine.
Having said that, no real need, should I remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, your call to make, if its a quality of life feature we can keep both
Co-authored-by: David Maranto <34867698+DM1122@users.noreply.github.com>
Resolves #6 with new backend API of form:
Note: this is slightly different from description in #6 due to Requirements DB changes.