Categorygithub.com/kayceeDev/CRM-Project
modulepackage
0.0.0-20220906063411-6c918305f1c2
Repository: https://github.com/kayceedev/crm-project.git
Documentation: pkg.go.dev

# README

GO-CRM-REST-API

Features

All REST APIs (GET, POST, PATCH, DELETE) Start server inside the project root directory

Create src/github.com/kayceeDev folder structure inside your GOPATH. for me it is /home/ekene/go/src/github.com/kayceeDev where ekene is the username for my linux machine.

cd /home/ekene/go/src/github.com/kayceeDev
git clone project_url

Remember to replace project_url

cd cloned_project_folder
go install
go mod tidy

lastly:

go run main.go

The application handles the following 5 operations for customers in the "database":

Getting a single customer through a /customers/{id} path
Getting all customers through a the /customers path
Creating a customer through a /customers path
Updating a customer through a /customers/{id} path
Deleting a customer through a /customers/{id} path

API

Get All customers

URL: GET localhost:8080/customers

Response:

[
    {
    "id": "0",
    "name": "John Doe",
    "role": "Software Developer 53",
    "email": "[email protected]",
    "phone": 5550199,
    "contacted": true
    },
    {
    "id": "3",
    "name": "John Doe",
    "role": "Software Developer 46",
    "email": "[email protected]",
    "phone": 5550199,
    "contacted": true
    },
    {
    "id": "4",
    "name": "Example Name",
    "role": "Example Role",
    "email": "Example Email",
    "phone": 5550199,
    "contacted": true
    },
    {
    "id": "5",
    "name": "Example Name",
    "role": "Example Role",
    "email": "Example Email",
    "phone": 5550199,
    "contacted": true
    },
    {
    "id": "6",
    "name": "Example Name",
    "role": "Example Role",
    "email": "Example Email",
    "phone": 5550199,
    "contacted": true
    }
]

Get Customer by ID

URL: GET localhost:8080/customers/0

Response:

 {
    "id": "0",
    "name": "John Doe",
    "role": "Software Developer 53",
    "email": "[email protected]",
    "phone": 5550199,
    "contacted": true
    },

Add new Customer

URL: POST localhost:8080/customers

Body

{
"name": "John Doe",
"role": "Software Developer 53",
"email": "[email protected]",
"phone": 5550199,
"contacted": true
}

Response: If the customer array length is 0 then id:1


{
"id":"1",
"name": "John Doe",
"role": "Software Developer 53",
"email": "[email protected]",
"phone": 5550199,
"contacted": true
}

Update a Customer

URL: PUT localhost:8080/customers/1

Body

{
"id": "1",
"name": "Gyanendra Verma"
}

Response:

{
"id":"1",
"name": "Gyanendra Verma",
"role": "Software Developer 53",
"email": "[email protected]",
"phone": 5550199,
"contacted": true
}

Delete a Customer

URL: DELETE localhost:8080/customer/1
Response:

```Json
The event with ID 1 has been deleted successfully

# Packages

No description provided by the author
No description provided by the author