The project represents the backend of a customer relationship management (CRM) web application. As users interact with the app via some user interface, your server will support all of the functionalities:
All REST APIs (GET, POST, PATCH, DELETE)
through a the /customers path
through a /customers/{id} path
through a /customers path
through a /customers/{id} path
through a /customers/{id} path
- Getting a list of all customers
url : GET localhost:3000/customers
- Response
[
{
"id": "1",
"name": "Tom",
"role": "Software Engineer",
"email": "[email protected]",
"phone": 123456892,
"contacted": true
},
{
"id": "2",
"name": "Tim",
"role": "Senior Software Engineer",
"email": "[email protected]",
"phone": 213456892,
"contacted": false
},
{
"id": "3",
"name": "Max",
"role": "Product Manager",
"email": "[email protected]",
"phone": 231564892,
"contacted": true
},
{
"id": "4",
"name": "Joe",
"role": "Software Engineer",
"email": "[email protected]",
"phone": 123456892,
"contacted": true
},
{
"id": "5",
"name": "Ross",
"role": "Civil Engineer",
"email": "[email protected]",
"phone": 123456892,
"contacted": true
},
{
"id": "6",
"name": "Adam",
"role": "IT Support Engineer",
"email": "[email protected]",
"phone": 123456892,
"contacted": true
}
]
- Getting a single customer
url : GET localhost:3000/customers/{id}
- Response
{
"id": "1",
"name": "Tom",
"role": "Software Engineer",
"email": "[email protected]",
"phone": 123456892,
"contacted": true
}
- Adding a customer
url : POST localhost:3000/customers
- Body
{
"name": "John",
"role": "Software Developer",
"email": "[email protected]",
"phone": 123456789,
"contacted": true
}
- Response
[
{
"id": "1",
"name": "Tom",
"role": "Software Engineer",
"email": "[email protected]",
"phone": 123456892,
"contacted": true
},
{
"id": "2",
"name": "Tim",
"role": "Senior Software Engineer",
"email": "[email protected]",
"phone": 213456892,
"contacted": false
},
{
"id": "3",
"name": "Max",
"role": "Product Manager",
"email": "[email protected]",
"phone": 231564892,
"contacted": true
},
{
"id": "4",
"name": "Joe",
"role": "Software Engineer",
"email": "[email protected]",
"phone": 123456892,
"contacted": true
},
{
"id": "5",
"name": "Ross",
"role": "Civil Engineer",
"email": "[email protected]",
"phone": 123456892,
"contacted": true
},
{
"id": "6",
"name": "Adam",
"role": "IT Support Engineer",
"email": "[email protected]",
"phone": 123456892,
"contacted": true
},
{
"id": "6cf26e2f-4d90-43b2-99e3-e4e89f2e891e",
"name": "John",
"role": "Software Developer",
"email": "[email protected]",
"phone": 123456789,
"contacted": true
}
]
- Updating a customer's information
url : PATCH localhost:3000/customers/{id}
- Body
"name": "Jo",
"role": "Software Developer",
"contacted": true
- Response
[
{
"id": "1",
"name": "Tom",
"role": "Software Engineer",
"email": "[email protected]",
"phone": 123456892,
"contacted": true
},
{
"id": "2",
"name": "Tim",
"role": "Senior Software Engineer",
"email": "[email protected]",
"phone": 213456892,
"contacted": false
},
{
"id": "3",
"name": "Max",
"role": "Product Manager",
"email": "[email protected]",
"phone": 231564892,
"contacted": true
},
{
"id": "4",
"name": "Joe",
"role": "Software Engineer",
"email": "[email protected]",
"phone": 123456892,
"contacted": true
},
{
"id": "5",
"name": "Ross",
"role": "Civil Engineer",
"email": "[email protected]",
"phone": 123456892,
"contacted": true
},
{
"id": "6",
"name": "Adam",
"role": "IT Support Engineer",
"email": "[email protected]",
"phone": 123456892,
"contacted": true
},
{
"id": "6cf26e2f-4d90-43b2-99e3-e4e89f2e891e",
"name": "Jo",
"role": "Software Developer",
"email": "[email protected]",
"phone": 123456789,
"contacted": true
}
]
- Removing a customer
url : DELETE localhost:3000/customers/{id}
- Response
{
"id": "6cf26e2f-4d90-43b2-99e3-e4e89f2e891e",
"name": "Jo",
"role": "Software Developer",
"email": "[email protected]",
"phone": 123456789,
"contacted": true
}
Dummy data is in data.go file
./CRM-Backend
encoding/json
The applications leverages the encoding/json package to parse JSON data.
io/ioutil
The application leverages the io/ioutil package to read I/O (e.g., request) data.
github.com/google/uuid
Google UUID GitHub project to create a unique id for the customers.
github.com/gorilla/mux
The application uses a router (e.g., gorilla/mux, http.ServeMux, etc.) that supports HTTP method-based routing and variables in URL paths.