This is a basic CRUD implementation
To get a local copy up and running follow these simple steps.
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
- Clone the repo
git clone https://github.com/nicholas570/TypeOrm-MySql.git
- Install NPM packages
npm install
- Run the server
npm run start:dev
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>
...
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 |