The task is to develop a basic backend API for Instagram.Below are the details.
You are required to Design and Develop an HTTP JSON API capable of the following operations,
• Create an User
- Should be a POST request
- Use JSON request body
- URL should be ‘/user'
• Get a user using id
- Should be a GET request
- Id should be in the url parameter
- URL should be ‘/user/<id here>’
• Create a Post
- Should be a POST request
- Use JSON request body
- URL should be ‘/posts'
• Get a post using id
- Should be a GET request
- Id should be in the url parameter
- URL should be ‘/posts/<id here>’
• List all posts of a user
- Should be a GET request
- URL should be ‘/posts/user/<id here>'
go get github.com/julienschmidt/httprouter
go get gopkg.in/mgo.v2
- go run main.go
- Use Postman for testing each function