Connecting ExpressJS to MySQL and creating an API Endpoint Automations.
[ADD] Role Statement
[ADD] Set request CORS in .env
[ADD] Method Operation Created, Read, Update, & Delete
[FIX] Cors Request
git clone https://github.com/fitri-hy/mysql-endpoint-express.git
cd mysql-endpoint-express
npm i mysql-endpoint-express
DB_HOST=localhost
DB_PORT=5000
DB_USER=username
DB_PASSWORD=password
DB_DATABASE=database
PREFIX_ROLE='admin'
ALLOWED_ORIGIN='*'
ALLOWED_METHODS='GET, POST, PUT, DELETE'
ALLOWED_HEADERS='Content-Type, Authorization'
require('mysql-endpoint-express');
node index.js`
Open in browser: http://localhost:5000/api
Don't forget to give stars Follow Me: FOLLOW