Skip to content

Latest commit

 

History

History
132 lines (89 loc) · 3.3 KB

README.md

File metadata and controls

132 lines (89 loc) · 3.3 KB

Instagram-API-Clone

It is a basic version of a RESTful API based on Instagram where we can create user, get the users, create post and get post and get all posts of an user.

Description

A User has the Following details

- Id
- Name
- Email
- Password

A post has the Following details

- Id
- Caption
- Image URL
- Posted Timestamp

Major Features

  • Feature 1- Create an User using the details by the POST request
  • Feature 2- Get an User using their ID by GET request
  • Feature 3- Create a Post using the details by POST request
  • Feature 4- Get a Post using the details of ID by GET request
  • Feature 5- Get all Posts of User using the the Unique ID of the User by GET request
  • Feature 6- Impelmented Pagination to get all Posts of User using the the Unique ID of the User by GET request

Additonal Features

  • Hashed to protect password so that it cannot be Reverse Engineered
  • Implemented Thread security by Implementing Locks
  • Fully Structured Code with code reusability
  • Pagination for the list endpoint

Run Locally

Clone the project

  git clone https://github.com/ayan2809/Instagram-API-Clone

Install Dependencies

  git mod init test3

Run the Code

   go run instagram.go

Usage/API Calls

To Create an Instagram user on the database using POST request

   http://localhost:4000/users

To Get the user data using their unique id using the GET request

   http://localhost:4000/users/{id}

To Create an Instagram post on the database using POST request

   http://localhost:4000/posts

To Get the instagram post data using the unique id of the post and GET request

   http://localhost:4000/posts/{id}

To Get all the instagram posts of an user using the unique id of the user and GET request

   http://localhost:4000/posts/users/{id}

To Get a certain limited instagram posts of an user using the unique id of the user and GET request

   http://localhost:4000/posts/users/{id}&limit=3

Thread Safety Feature using Locks