-
Notifications
You must be signed in to change notification settings - Fork 368
Mocking stream endpoint #8
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
Conversation
And updating ‘item_id’ to ‘id’
It now makes sense to have a generic appendItemArray function
# Conflicts: # package.json
| comments: rootComments | ||
| })) | ||
|
|
||
| Object.keys(childComments).reduce((prev, key) => { |
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.
From @riley: since this block doesn't return things by keys, we should use a for each here.
routes/api/stream/index.js
Outdated
|
|
||
| router.get('/', (req, res) => { | ||
| console.log('Stream endpoint has been hit with asset_id ', req.query.asset_id) | ||
| res.setHeader('Content-Type', 'application/json'); |
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.
res.json() will take care of the header and stringify for you.
|
|
||
| const router = express.Router(); | ||
|
|
||
| router.get('/', (req, res) => { |
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.
Add a third param called next here, which can be used to pass errors down the first error handler it finds down the chain.
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'll add it later. I think linting might fail if there are unused vars, and this is a mock for now.
And fixing a few small issues with item posting.
# Conflicts: # routes/api/index.js
res.json is not a Promise.
riley
left a comment
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.
lgtm 💯
What does this PR do?
Creates a stream endpoint that returns a static json object and adjusts the frontend to expect data of that format.
How do I test this PR?
npm run buildnpm starthttp://localhost:3000/client/coral-embed-stream/samplearticle.htmlNotes
npm buildscript for efficiency, someone with more of a handle on the architecture (i.e. @wyattjoh or @okbel) should feel free to refactor.