GithubHelp home page GithubHelp logo

course-rating-api's Introduction

Course Rating API

A Node.js REST API that provides a way for users to review educational courses. Users will be able to see a list of courses in a database; add courses to the database; and add reviews for a specific course. The database used is MongoDB.

Running It

npm start

Modules Used

  • express
  • mongoose
  • ramda
  • basic-auth
  • bcrypt
  • mocha
  • supertest

Authentication

Basic-Auth was used to authenticate users by the server. bcrypt.js was used to create hashed passwords and used to compare sent passwords against the hashed passwords.

Route Paths

/api/users

Paths Explanation
GET /api/users Returns authenticated user.
POST /api/users Creates a user, no content returned.

/api/courses

Paths Explanation
GET /api/courses Returns all courses with "_id" and "title" properties.
GET /api/courses/:courseId Returns all Course properties and related user and review documents for the provided course ID.
POST /api/courses Creates a course, no content returned.
PUT /api/courses/:courseId Updates a course for specified course ID, returns no content.
POST /api/courses/:courseId/reviews Creates a review for the specified course ID, returns no content.

Testing

Testing was used with mocha.js and supertest.js. If you want to run the tests, make sure to seed the database with Documents by going to the seed-data directory and type the following commands:

mongoimport --db course-api --collection courses --type=json --jsonArray --file courses.json
mongoimport --db course-api --collection users --type=json --jsonArray --file users.json
mongoimport --db course-api --collection reviews --type=json --jsonArray --file reviews.json

If you don't seed the database, some of the test will currently fail, so make sure to seed it first.

To run the tests type:

npm test

To-Do

  • make tests more reliable without seeding the database as a dependent for some tests
  • make a front-end UI

course-rating-api's People

Contributors

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