Complete CRUD app with MySQL and Expressjs
Make sure to install the dependencies:
# yarn
yarn install
# npm
npm install
Create a .env
file and add the following variables:
DB_HOST= # Database Host
DB_USER= # Database User
DB_PASS= # Database Password
DB_NAME= # Database Name
Start the development server on http://localhost:3001
# yarn
yarn dev
# npm
npm run dev
GET / # Get all posts with pagination
GET /:id # GEt Single post
POST / # Add post
POST /many # Add multiple posts
PATCH / # Update one post
DELETE / # Delete one post