Giter VIP home page Giter VIP logo

nodejs-kata's Introduction

Work in Progress

What is completed

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

What is missing

  • 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

Node.js Kata - Part 1: Library

Code kata in Node.js where you have to write a library of books and magazines.

A code kata is an exercise in programming which helps a programmer hone their skills through practice and repetition.

Topic

You have to implement an abstracted and simple library system.

Frame conditions

  1. 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.

  2. 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.

  3. 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.

  4. Develop your code based on Node.js language level 8.

  5. Keep the following priorities in mind while you implementing - in the mentioned order:

    1. Clean Code
    2. Loose coupling
  6. Given resources:

    Hint: There is a reason why there are so many books and authors in german with umlauts.

    • authors.csv: Contains authors with its email, firstName and lastName.
    • books.csv: Contains books with its title, description, one or more authors and an isbn.
    • magazines.csv: Contains magazines with its title, one or more authors, a publishedAt and an isbn.
  7. 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.

Tasks

Main tasks

Hint:

  1. 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.

  2. 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
  1. Implement the API on defined on point (2)

Optional tasks

Hint: Optional means optional.

  1. Use MongoDB to store and operate on data

  2. Write useful Unit tests.

  3. Add a route to add a book or a magazine to the data structure of your software

  4. Add a route to export each resource to CSV

  5. Add a docker to run your server

Procedure

  1. Get the code. (Git clone)

  2. Open in your favorite IDE.

  3. Start the kata.

  4. Publish your code and give us the url.

FAQ

How to run your application?
npm run start
How to run your tests?
npm run lint
npm run test

Rating

License

See LICENSE file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.