Skip to content

nicholas570/classic-models-api

Repository files navigation

Table of Contents

  1. About The Project
  2. Getting Started
  3. Routes
  4. Acknowledgements

About The Project

This is a basic CRUD implementation

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

You need to install this Mysql database: https://www.mysqltutorial.org/mysql-sample-database.aspx

  • npm
    npm install npm@latest -g
  • node > 12
    npm install node@latest -g

Installation

  1. Clone the repo
    git clone https://github.com/nicholas570/TypeOrm-MySql.git
  2. Install NPM packages
    npm install
  3. Run the server
    npm run start:dev

Env sample

PORT=8080

TYPEORM_CONNECTION = <mysql>
TYPEORM_HOST = <localhost>
TYPEORM_PORT = <3306>
TYPEORM_USERNAME = <username>
TYPEORM_PASSWORD = <pwd>
TYPEORM_DATABASE = <db>
TYPEORM_SYNCHRONIZE = <true>
TYPEORM_LOGGING = <false>
TYPEORM_ENTITIES = <src/entity/**/*.ts>

JWT_PRIVATE_KEY = <private key>
...

API Routes:

Method Path Purpose
GET /api/employees?officeCode Retrieve all employees
GET /api/employees/:employeeNumber Retrieve one employee
POST /api/employees Create one employee
PUT /api/employees/:employeeNumber Update one employee
DELETE /api/employees/:employeeNumber Delete one employee
GET /api/offices Retrieve all offices
GET /api/offices/:officeCode Retrieve one office
POST /api/offices Create one office
PUT /api/offices/:officeCode Update one office
DELETE /api/offices/:officeCode Delete one office

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published