rudolphh / express-product-api

a RESTful api for users, products (i.e. brands, categories), favorites using Express

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Express Product API Project (214)

API Fundamentals, authentication, encryption, and persistence

Installation

Download here OR

git clone https://github.com/rudolphh/express-product-api.git
cd express-product-api
npm install

Environment

Create a .env file in the root directory of the project with the following

PORT=3033
DB_PORT=3306
DB_HOST=localhost
DB_USER=root
DB_PASS=root
DB_NAME=express_rudazon
TOKEN_EXPIRES_IN=30m
REFRESH_TOKEN_EXPIRES_IN=60m
SECRET_KEY=somekindofsecrettext

These can be adjusted to your preference, including DB_NAME, the name of the database schema the seeder will use to automatically create some initial data for you in the database.

MySQL Installation

Make sure to have MySQL installed for your OS.

Docker MySQL

Use the link above for instructions, or if you have Docker use the docker-compose.yml file in the root folder.
In the project root, just run the command:

docker-compose up -d

Run

npm start

Verify the deployment by navigating to your server address localhost:3033/hello in your favorite browser

Test routes

If you don't have Postman, or Insomnia, or don't care to use those, there is a test.rest file in the root directory.
This uses the Rest Client extension within VSCode for simple API testing Image of test.rest

Used within the Project

Technology Description
node.js Evented I/O for the backend
Express Fast node.js network app framework @tjholowaychuk
jsonwebtoken An implementation of JSON Web Tokens
bcrypt A library to help you hash passwords.
mysql2 MySQL client for Node.js with focus on performance
dotenv Loads environment variables from .env file

Development

Want to contribute? Great!

License

MIT

Free Software, Heaven Yeah!

About

a RESTful api for users, products (i.e. brands, categories), favorites using Express


Languages

Language:JavaScript 100.0%