Simple Instagram Backend REST API using GO and MongoDB
To be able show desired features of REST API such as:
-
POST /users/
creates a new user using JSON request body -
GET /users/{id}
returns details of specific user as JSON -
POST /posts/
creates a new post using JSON request body -
GET /posts/{id}
returns specific post as JSON -
GET /posts/users/{id}
returns list of all posts of specific user as JSON -
server_test.go
unit tests
The API should be developed only using Go & MongoDB.
No frameworks / third-party libraries to be used.
Pagination and Unit Tests can be implemented
A User object should look like this:
{
"id": "ID",
"name": "name of the user",
"email": "email of the user",
"password": "password of the user",
}
A Post object should look like this:
{
"id": "ID",
"caption": "caption to the post",
"imageURL": "link to the image",
"timestamp": "password of the user",
"userID": "user ID of owner to the post",
}
POST /users/
GET /users/{id}
POST /posts/
GET /posts/{id}
GET /posts/users/{id}
Unit Tests => server_test.go