for 2 hours, main goal is complete, software serve data with API graphql. example:
GET http://localhost:3000/graphql?query=query{books { title }}
result books list
GET http://localhost:3000/graphql?query=query{bookByIsbn(isbn:"3214-5698-7412") { title }}
result book data
Data storage MongoDB
- e2e test of api route with mocha and chai
- export resource to csv implementation example: use mongoexport to export to csv file then serve file by express with download method.
- Documentation with comment
- Use docker: i usually use docker-compose with docker mongo and pm2 docker for node app (with restart and log file).
- Think about data, data maybe need rework: authors can be store in array
Code kata in Node.js where you have to write a library of books and magazines.
You have to implement an abstracted and simple library system.
-
You have exact 2 hours of time - no minute longer.
If you reach this time limit stop your work immediately. It is one part of the kata to respect this time limit.
-
There are no restrictions on how to use the provided time. If you want to code the entire time, take a break or a cigaret - itβs up to you.
-
This is a real world situation. You are allowed to consult the Internet, use every library you want, call a friend ...
BUT: You are not allowed to do pair programming. AND If you have already done this kata before to have a look at your previous implementation.
-
Develop your code based on Node.js language level 8.
-
Keep the following priorities in mind while you implementing - in the mentioned order:
- Clean Code
- Loose coupling
-
Given resources:
Hint: There is a reason why there are so many books and authors in german with umlauts.
authors.csv
: Contains authors with itsemail
,firstName
andlastName
.books.csv
: Contains books with itstitle
,description
, one or moreauthors
and anisbn
.magazines.csv
: Contains magazines with itstitle
, one or moreauthors
, apublishedAt
and anisbn
.
-
Rating:
- We'll mostly rate your code and see how you structure and think it.
- Finishing the Kata in 2h, it's not the primary goal.
Hint:
-
Your software should read all data from the given CSV files in a meaningful structure. For the given dataset is for test development/test, we'll run it with a larger dataset.
-
Create a GraphQL API that :
- List all books
- List all magazines
- Find a book by its
isbn
- Magazine by its
isbn
- List all
authors
- Find all book by their by their
authors
- Implement the API on defined on point (2)
Hint: Optional means optional.
-
Use MongoDB to store and operate on data
-
Write useful Unit tests.
-
Add a route to add a book or a magazine to the data structure of your software
-
Add a route to export each resource to CSV
-
Add a docker to run your server
-
Get the code. (Git clone)
-
Open in your favorite IDE.
-
Start the kata.
-
Publish your code and give us the url.
npm run start
npm run lint
npm run test
See LICENSE file.