An Instagram API made using Go and MongoDB
-
Create an User (POST request)
URL used: http://localhost:27017/users
The data is entered in body in JSON format and _id is automatically created
The user is successfully inserted to the database
-
Get user using id (GET request)
URL used: http://localhost:27017/users/6161701c6c8378c960d53965
The User details of the user id in the url is displayed
-
Create a post (POST request)
URL used: http://localhost:27017/posts
The data is entered in body in JSON format and _id is automatically created
The post is successfully inserted to the database
-
Get post using post id (GET request)
URL used: http://localhost:27017/posts/61617ca36c8378aef4d0a3a9
The post details of the post id in the url is displayed
-
Get all posts of a specific user (GET request)
URL used: http://localhost:27017/posts/users/61617076dc25d3de5f044084
All the posts of the user with the user id in the url are displayed
-
Get all users (GET request)
URL used: http://localhost:27017/users
Details of all the users in the database
-
Get all posts (GET request)
URL used: http://localhost:27017/posts
Details of all the posts in the database
Note: The (upper)body data has no significance when the request is GET
- Run the command mongod in your cmd terminal at the directory where mongodb is installed.
- Make sure a database is created with the name Instagram.
- Use mongodb compass for easy creation of database and also for viewing the data in the database.
- Use the URLs in a service like postman for POST and GET requests.