Skip to content
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

Implement a /citations/doi enpoint #2

Open
RobSullivan opened this issue Apr 1, 2015 · 0 comments
Open

Implement a /citations/doi enpoint #2

RobSullivan opened this issue Apr 1, 2015 · 0 comments

Comments

@RobSullivan
Copy link
Owner

RobSullivan commented Apr 1, 2015

Citation data from PubMed is also available as the is_ref_of and citation_count fields in a document.

It might be useful to know which articles citing a doi are free to access in PMC so a citations end point is needed.

There is a chance to discuss the best possible endpoint (making it RESTful, for example) but for now I think /citations/doi/:doi might work.

Please note this may not be the best way to implement it as I was learning as I was going along when developing this. Here's your chance to learn as you go too 😄

Gaps in my knowledge will be missing but I have tried to keep the steps as clear as possible. Keep an eye out for #2 commented out in the code and please don't hesitate to ask questions.

One possible way to approach this is to make this test pass.

  1. Define a route path in app.js. As this app is built using Express, more on defining routes can be read here http://expressjs.com/guide/routing.html
  2. Think of an appropriate name for the function to be called when this route path is requested.
  3. In the routes directory create a new file and model the query to the database on this one making changes where necessary.
  4. The response needs to have a header set to Access-Control-Allow-Origin: * (also see enable cors #11). I'll check on how to do this and edit this step soon. Or if you find the answer before I do please let me know 😃 update see http://expressjs.com/4x/api.html#res.set
  5. Now I think that should be it. Start the app running and see what happens, or have a go at writing a test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant