Skip to content

VarunAgarwalOfficial/Instagram-Backend-API-using-Go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Task | Instagram Backend API

Submission for Appointy technical task for internship round

Usage

go run main.go

or

./main.exe

API End points

1. POST /users
with body like :
{
    "name":"Varun Agarwal",
    "email": "varun.agarwal2019@vitstudent.ac.in",
    "password" : "12345678"
}

This will Store your user information to mongoDB with password encrypted with MD5 plot

2. GET /users/userId

This will Retrive your user information from mongoDB with password encrypted with MD5 plot

3. POST /posts
with body like :
{
    "caption":"Hello World this is my first Post" ,
    "imageUrl" : "instagram.com/1.png",
    "time" : "6:20 PM 09/10/2021",
    "userId" : "61619a80bf07eff36d14bb4a"
}

This will Store your post in mongoDB plot

4. GET /posts/postId

This will Retrive your post information from mongoDB plot

5. GET /posts/users/userId/(optional)PageNO

This will retrive all posts from a use with a given PageNO (Default is page 1) (posts per page is set to 5)

As shown below , there are 7 Sample posts by user Varun (userId : 61619a80bf07eff36d14bb4a) in the system. plot

As shown below , the first 5 were loaded in the get request with default parameters plot

And the remaining 2 were loaded when the PageNO was given as 2 plot

Other Features

1. Passwords are securely stored such they can't be reverse engineered

2. The server thread safe by locking and unlocking each function call to 1 single thread

3. Pagination is used to list all the posts

License

MIT.

About

Submission for the Appointys technical task, in which we were tasked with constructing a RESTful replica of Instagram's API using the GO programming language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages