Coder Social home page Coder Social logo

rangeforce's Introduction

Description

Simple api service for creating learning modules, courses and categories.

Tech:

  • NestJs
  • MongoDb

Assumptions made:

Endpoints are created for the purpose of the required tasks, so it does not contain all CRUD functinoalities.

Category names are made unique because it seems logical that way. This also helps to index the field which makes it better to search by name.

Category, course or learning module, anything can be created independently and later on relations can be made by updating category or course as needed.

Note that the usage schema requires a userId, that is basically the learner id, but since this task does not include an auth flow so you can use any mongodb _id to fill it instead.

There is swagger for easily checking the api endpoints. When the app is running locally, then it can be visited on: http://localhost:4001/api#/

Goals:

  • Listing of modules by category name : you can get modules by typing a category name with partial match and case incensitivity. For example: If category is 'Computer' you can search with 'comp' and still get result. Try directly from swagger endpoint: /learning-module and query as 'computer'.

  • TOP 10 used modules of the month : the top number is created as query param so you can change it to any number to get different total list items. Try directly from swagger endpoint: /usage/top and query as 10.

Setup and installation

Create an .env file from .env.example

$ cp .env.example .env
$ yarn install

Running the app

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod

Or if you prefer to run with docker:

# production mode
$ docker build -t nestjs-app .
$ docker run -d -p 4001:4001 nestjs-app

Test

Some tests are written for controllers and services.

# unit tests
$ yarn run test

# test coverage
$ yarn run test:cov

# to run specific tests, for example on usage (from project root):
$ yarn test --testPathPattern=src/usage/usage.controller.spec.ts

If you previously ran with docker, then you can run the tests like this:

$ docker ps

# Execute the tests in the container with container id from docker ps earlier
$ docker exec -it <container_ide> yarn test

rangeforce's People

Contributors

tajikee avatar

Watchers

 avatar

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.