Its a simple golang server which stores Avengers record in mongodb. You can perform CRUD operations on it.
Run the following command to create application binary locally
$ make install
POST: http://localhost:8000/avengers/createNewAvenger
- Request Body:
{
"name" : "sourav patnaik",
"alias" : "sikan",
"weapon": "hammer"
}
- Response:
{
"InsertedID": "61de7b19c51fa632a454a881"
}
GET: http://localhost:8000/avengers/getAllAvengers
- Response:
[
{
"_id": "61de7b19c51fa632a454a881",
"name": "sourav patnaik",
"alias": "sikan",
"weapon": "hammer"
},
{
"_id": "61de88b8c51fa632a454a896",
"name": "jack danniel",
"alias": "jd",
"weapon": "sword "
}
]
PUT: http://localhost:8000/avengers/updateAvengerByName
- Request Body:
{
"name": "sourav patnaik",
"alias": "sikan, goodboy",
"weapon": "hammer, axe"
}
- Response
{
"MatchedCount": 1,
"ModifiedCount": 1,
"UpsertedCount": 0,
"UpsertedID": null
}
DELETE: http://localhost:8000/avengers/deleteAvengerByName?name=sourav patnaik
- Response:
{
"DeletedCount": 1
}