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

feat: add initial api lookup endpoint for entities with test #288

Closed
wants to merge 83 commits into from

Conversation

akhilesh26
Copy link
Contributor

@akhilesh26 akhilesh26 commented May 28, 2019

BB API

Run this initial setup for BB API.
Install dependencies using npm install
To check the endpoint, run the project without docker with npm run start-api.
Endpoints implemented:
http://localhost:9098/work/<bbid>
http://localhost:9098/work/<bbid>/aliases
http://localhost:9098/work/<bbid>/identifiers

To run the test for this endpoint use npm test ./test/src/api/routes/test-work.js

@coveralls
Copy link

coveralls commented May 29, 2019

Coverage Status

Coverage increased (+2.3%) to 42.914% when pulling 704e2a3 on akhilesh26:api into 3d5119c on bookbrainz:master.

@akhilesh26
Copy link
Contributor Author

The test will not pass because data is not pushed into bookbeainz_test. To pass the test, replace
database bookbrainz in place of bookbraiz_test in test.json file.

Copy link
Contributor

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, that's a good start!

Structure-wise, we will want to separate the website server and the API, meaning having the API be a separate Express server.
You'll want to copy src/server/app.js and see what you need to keep in that file to have an express server running. You will also want to copy /routes.js and keep only your new endpoints.

Finally, you can add a new section to config.json and config.example.json (and test.json) for the API; all the properties I can think of right now are port and versionPrefix: '/v1/', that you will then be able to use in your code where appropriate.

test/src/api/endpoints/test-work.js Outdated Show resolved Hide resolved
test/src/api/endpoints/test-work.js Outdated Show resolved Hide resolved
test/src/api/endpoints/test-work.js Outdated Show resolved Hide resolved
@akhilesh26
Copy link
Contributor Author

@MonkeyDo, Please check it once again, mainly setup related things. I will try to complete the first-week work in this weekend.

@akhilesh26
Copy link
Contributor Author

@MonkeyDo Insertion of data in the test database is creating some problem on running the test, please check it.

Copy link
Contributor

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a few comments of lines in the new api/app.js that are not useful for the API.
Also check for unused imports once they're deleted.

src/api/app.js Outdated Show resolved Hide resolved
src/api/app.js Outdated Show resolved Hide resolved
src/api/app.js Outdated Show resolved Hide resolved
src/api/app.js Outdated Show resolved Hide resolved
Solving an issue with uncaught exceptions that would break the test harness
To make sure no code in src/api or src/common depends on any code in src/server or src/client
Akhilesh Kumar and others added 29 commits June 17, 2019 15:46
Solving an issue with uncaught exceptions that would break the test harness
To make sure no code in src/api or src/common depends on any code in src/server or src/client
@akhilesh26 akhilesh26 closed this Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants