This is Node.js + Express rest API with a Relational Database in PostgreSQL. Front-end builded in Vue.js + Boostrap 4.
--> How to run the API
- clone repository and go to project folder
git clone https://github.com/Francisco-gui/employee-crud.git
cd employee-crud
cd employee-api
- Create a new database and a .env PostgreSQL connection string:
Schema:
CREATE TABLE employee (
employee_id uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
name VARCHAR(255) NOT NULL,
job_role VARCHAR(255) NOT NULL,
salary NUMERIC(12,2) NOT NULL,
birth DATE NOT NULL,
employee_registration INTEGER NOT NULL
)
PostGreSQL connection string:
DATABASE_URL=postgres://YourUserName:YourPassword@YourHostname:5432/YourDatabaseName
- run the development server:
npm run dev
You can use insomnia to test all endpoints
# ROUTES
GET /employees
POST /employees
GET /employees/:id
PUT /employees/:id
DELETE /employees/:id
--> How to build Front-end
- go to project folder
cd employee-crud
cd front-vue2
- Run the command:
npm run serve