The User Portal API is a REST API built with Express, Typescript, and TypeORM. It allows clients to retrieve data from the User Portal database without making a direct connection.
The User Portal API uses a MySQL database. Specifically, it was developed using a locally-running MySQL 8.0.22 server.
Install mysql via Homebrew
brew install mysql
Assure that you can run the server and login with:
mysql.server start
mysql -uroot
Create a user on the MySQL server and grant it privileges. For ease of development of this proof of concept, the user was given all privileges. This is potentially dangeros and should not be done in production.
CREATE USER 'test'@'localhost' IDENTIFIED BY 'test';
GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost';
Once the user is created, create the database itself with:
CREATE DATABASE user_portal;
This application was developed using Node.js v14.15 (the latest LTS version at time of writing).
If not already installed, get NVM to manage node installations.
Install Node.js with:
nvm install 14.15
This command will make sure that the database is in sync with the application's Entity classes, run database migrations (if necessary), and start the API.
This command will run all unit tests for the API.