Giter Club home page Giter Club logo

rest-api-sql's Introduction

Rest API to manage courses and user

This Rest API allow all CRUD operations

How to get started with the files provided

  1. Run npm install to get all the project dependencies.
  2. Run npm run seed to initialize the table with the data provided in the files.
  3. Run npm start to run the application.
  4. If you have nodemon install in your computer, simply type nodemon in the terminal to run the application.

How to access a course

  1. Do not try to edit any of the courses provided because the password is not available.
  2. Create your own user and password then create courses and associate them to the user you created.
  3. To edit or delete a course you must enter your credentials, email and password. In postman open a new tab, then in the menu choose authorization, in the type drop down menu select BASIC AUTH.
  4. Go to the body tab and execute the task you desire.

How to run use this application using postman

Create a user.

  1. Using POST* method go to route api/users and provide the user information. See example below
{
    "firstName": "Alex",
    "lastName": "Thomas",
    "emailAddress": "[email protected]",
    "password": "alexthomas"
}

Create a course.

  1. Using post method go to route api/courses and provide the course information. See exaple below. Note: when you create a course you need to add the userId of the user associated with the course. You can look at the user table to find the user id.
{
    "title": "How to draw a house",
    "description": "You will learn to draw a house using two-point perspective",
    "estimatedTime": "1 hour",
    "materialsNeeded": "pen, paper, eraser",
    "userId": 2
}

Courses routes

  1. using PUT method. Got to route api/courses/:id. This will update a course using course ID.
  2. using DELETE method. Gto to route api/courses/:id. This will delete a course using course ID.
  3. using GET method. Got to route api/courses/:id. This will select a course using course ID.

rest-api-sql's People

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.