Skip to content

leoangr/node-express-postgres-crud-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Client Management API

A simple CRUD API built with Node.js, Express, and PostgreSQL.
This project allows you to manage client data with endpoints for creating, reading, updating, deleting and searching clients.


Tech Stack


Getting Started

1. Clone Repo

git clone https://github.com/leoangr/node-express-postgres-crud-api.git
cd node-express-postgres-crud-api

2. Install Dependencies

npm install

3. Configure Environment Variables

Create an .env file based on .env.example:

4. Setup PostgreSQL Table

CREATE TABLE clients_tb (
	id SERIAL PRIMARY KEY,
	name VARCHAR(100) NOT NULL,
	email VARCHAR(100) UNIQUE NOT NULL,
	job VARCHAR(50),
	rate NUMERIC(10, 2) DEFAULT 100.00,
	isActive BOOLEAN DEFAULT TRUE
);

5. Run the Development Server

npm run dev

Server will run at: http://localhost:3000


API Endpoints

Get all clients

GET  /api/clients

Add new clients

POST  /api/clients/

Request Body:

{
    "name": "Sally",
    "email": "sally@gmail.com",
    "job": "Web Developer",
    "rate": 80,
    "isactive": "true"
}

Update client by ID

PUT /api/clients/:id

Delete client by ID

DELETE /api/clients/:id

Search client by Name, Email Or Job

GET /api/clients/search?q=keyword

Author

Created by leoanggoro.my.id

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published