/Smith-API

Medieval Items API ⚒️

Primary LanguageTypeScript

Smith API 🔨

Project Context 💡

Medieval items Store, in the format of an API, following the MSC architecture (Model -> Service -> Controller), where you can do the basic operations you can do in a database (CRUD). That's my first project using Typescript 💙

Acquired Knowledge 📖

In this project, I was able to:

  • Configure a Node.js project with Typescript;
  • Create an Express application using Typescript;
  • Use classes and interfaces to structure the MSC layers;
  • Declare variables and functions with Typescript typing;

Main Technologies used 🧰

TypeScript Express Node.JS MySQL JWT Joi Docker Insomnia
typescript express nodejs mysql jwt joi docker insomnia

Running the application ⚙️

  1. Clone the repository and enter it
git clone git@github.com:ImVictorM/Smith-API.git && cd Smith-API

Methods

🐋 Running with docker (recommended)

You must have docker and docker-compose installed

  1. Get the containers running
docker-compose up -d
  1. Enter the server's container
docker exec -it trybesmith bash
  1. Install the dependencies
npm install
  1. (Optional) Create/recreate and populate the database

if this step fails, wait a while untill the mysql container is running propperly

npm run db:create
  1. Start the server
npm run start
---- or ----
npm run dev (with nodemon)

🖥️ Running locally

You must have node and MySQL installed

  1. Install the dependencies
npm install
  1. Rename the file .env.example to .env

  2. (Optional) Create/recreate and populate the database

npm run db:create
  1. Start the server
npm run start
---- or ----
npm run dev (with nodemon)

Endpoints 🌐

Click here to export automatically:

Run in Insomnia}

Or just import the file insomniaRoutes.json inside your environment: https://docs.insomnia.rest/insomnia/import-export-data