background
Home / Portfolio / CRUD Express
PORTFOLIO

CRUD Express

A simple Product CRUD app using Express, MySQL and Swagger Docs.

#ExpressJS  #MySQL  #Swagger  

Simple CRUD Express API Application

A simple Product CRUD app using Express, MySQL and Swagger Docs.

For live demo, currently it's not available. 🙏

But you can download and clone the source code.

Source Code is available on my repository on Github.

Features

Some features of this application:

  • Category
    • CRUD
  • Product
    • CRUD with image upload
  • Item
    • CRUD with image upload

Tech Stack

Prerequisites

Installation

Clone the repository.

1git clone https://github.com/raprmdn/simple-product-crud-express.git
bash

Install the dependencies.

1npm install
bash

create or copy .env.example to .env and fill the environment variables.

1cp .env.example .env
bash

.env
1NODE_ENV= 2 3PORT= 4APP_URL=http://localhost: 5 6DB_DATABASE= 7DB_USERNAME= 8DB_PASSWORD= 9DB_HOST= 10DB_DIALECT=
dotenv

By default:

  • NODE_ENV is development
  • PORT is 5000

Create database and run the migration.

1# Create database 2npx sequelize-cli db:create 3# or 4sequelize db:create 5 6# Run the migration 7npx sequelize-cli db:migrate 8# or 9sequelize db:migrate 10 11# Run the seed 12npx sequelize-cli db:seed:all 13# or 14sequelize db:seed:all
bash

Usage

Run the application.

1npm run dev
bash

API Documentation

API Documentation is available on /api-docs endpoint.

Open your web browser and go to http://localhost:{port}/api-docs.

Screenshots

Some screenshots of API Documentation with Swagger UI.

CRUD Express API Documentation
List of categories and products
CRUD Express API Documentation
List of items
CRUD Express API Documentation
Create a new product
CRUD Express API Documentation
Create a new item