Skip to content

talent-path-pipeline/server

Repository files navigation

Server

Overview

Talent Path Pipeline Back-end


Table of Contents


Release Notes

Current Release:

Pre-Alpha (v0.0)

Release Details:

New Features

  • Login/Sign Up Routes
    • Generate Token on login/signup
    • Hash Passwords
  • Users CRUD API
  • Lessons CRUD API
  • Paths CRUD API
  • Courses CRUD API
  • YouTube
    • Transformer to translate length of videos

Bug Fixes

  • No bugs...

Improvements

  • No feedback...

Getting Started

The following setup will be broken down into two sections, setting it up for local development and setting it up for deployment on heroku.

Setting up for local development

  1. Clone the repo to your machine

  2. Run the following command npm i to install all packages

  3. Create a .env file on the root directory with the information from .env.default file

  4. Have Postgress running in the background.

  5. Run npm start to run the server

  6. Sequelize will generate all the tables for Postgress before the server begins listening for requests.

Setting up for deployment

Coming Soon!


Coding Standards

Naming conventions:

  • Classes/Components: Pascal case (e.g. HomePage.js)
  • Variables: Snake case (e.g. my_awesome_variable = 5)
  • Constants: Caps case (e.g. const GLOBAL_VARIABLE = 'a global string)
  • Folders: Kebab case (e.g. i-am-a-folder)
  • Functions: Camel Case (e.g. doSomethingPlease(input))
  • Git Branches: Kebab case with a descriptive name and prefaced by an 's' the number of the issue it deals with (e.g. for server issue #11: "AaD, I want to create associations between tables the branch should be named something like s11-table-associations).

Style consistency

We are using VSCode for development with the ESLint and Prettier extensions for consistency. Configuration files for both extensions are included in the root of this repository. If contributing, please either install those extensions or read through them and ensure your code complies with the rules listed.


Basic Structure

The back-end is structure like the following:

server/
├── config/
│   └── config.js
├── controller/
├── db/
├── middleware/
├── models/
│   ├── authentication/
│   ├── index.js
│   ├── learning-resources/
│   └── user-resources/
├── package.json
├── package-lock.json
├── README.md
├── routes/
│   ├── index.js
│   ├── private/
│   └── public/
├── server.js
├── services/
├── utils/
└── validations/

Descriptions coming soon!


Usage

Routes to use

  1. Registration

    • POST /api/user - Create user

      • Parameters

        Name Description
        body required Created user object
        (body) Example
        image

        Parameter content type: application/json
        Response Example
        Returns a Success Message and a Token:
        image

        Parameter content type: application/json
        Code Description
        200 successful operation
        400 Invalid username or password supplied
    • POST /api/user/login - Logs user into the system

      • Parameters

        Name Description
        body required Logs a user in
        (body) Example
        Login
        Parameter content type: application/json
        Response Example
        Returns a Success Message and a Token:
        image

        Parameter content type: application/json
        Code Description
        200 successful operation
        Headers:

        X-Token: User JWT token (string)
        400 Invalid username or password supplied
  2. Read

  • GET /api/user - Get user(s)

    • Parameters

      Name Description
      body optional Email of User you want to get.
      If not included, returns all users.
      (body) Example
      image

      Parameter content type: application/json
      Response Example
      Returns all Users:
      image

      Or

      Returns One User:
      image

      Parameter content type: application/json
      Code Description
      200 successful operation
      400 An error has occurred: Invalid data received.
  1. Update
  • PATCH /api/user - Get user(s)

    • Parameters

      Name Description
      body required Email of User you want to update. {email}
      Data that you want to update. {newData}
      -- newData can be an empty object.
      -- Only include data you want to update
      -- You can't update a password with this route
      (body) Example
      image
      image2

      Parameter content type: application/json
      Response Example
      Updates a User:
      image

      Parameter content type: application/json
      Code Description
      200 successful operation
      400 An error has occurred: Invalid data received.
  1. Delete
  • DELETE /api/user - Deletes a user

    • Parameters

      Name Description
      body required Email of User you want to delete.
      (body) Example
      image

      Parameter content type: application/json
      Response Example
      Deletes a User:
      image

      Parameter content type: application/json
      Code Description
      200 OK
      400 An error has occurred: Invalid data received.

About

Backend server for StoneHaven

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 6