REST API of Instagram's functionalities; developed using GO (and Mongo).

Instagram-backend-api

REST API of Instagram's functionalities; developed using GO (and Mongo).

Constraints:

  1. Complete API has been developed using Go
  2. MongoDB has been used to storage
  3. Only standard libraries have been used

Functionalities:

  1. Create a User
  • POST request
  • JSON request body used
  • Added data to the URL ‘/users'
  1. Display details of all users
  • GET request
  • Display the user (unique) id, name, email and hash of the password
  • URL: "/users"
  1. Fetch details of the user using id
  • GET request
  • Displays user id, name, email and hash of the password
  • URL: "/users/id"
  1. Create a Post
  • POST request
  • JSON request body used
  • Added data to the URL ‘/posts'
  1. Display details of all posts (like scrolling through the feed)
  • GET request
  • Display the post (unique) id, caption, imageURL and timestamp
  • URL: "/posts"
  1. Fetch details of all the posts of a particular user using id
  • GET request
  • Display the post (unique) id, caption, imageURL and timestamp (for all posts of that user)
  • URL: "/posts/id"

Added functionalities:

  1. Passwords have been securely stored such they can't be reverse engineered (using sha256)
  2. Only JSON format is accepted (validation added)
  3. Unique id is linking a user to his/her posts

Attributes:

  1. User:
  • ID
  • Name
  • Email
  • Password (saved in encrypted form; as a hash)
  1. Post:
  • Id
  • Caption
  • Image URL
  • Posted Timestamp

Directions to run the application:

Prerequisites/ Software requirements:

  • Go
  • Linux shell (eg. Gitbash)
  • Install mongo dependencies (run go get go.mongodb.org/mongo-driver/mongo)

Steps:

  • Clone this repository
  • cd to the folder "cmd" in the terminal
  • Run the command go run server.go; This should start the server
  • Open another terminal in this folder (cmd)
  • In this other terminal, run the commands for the specific functionality required: (make sure the path to curl is set under environment variables)
    • To create a new user, run curl localhost:3000/users -X POST -d '{"id":"<id>","name":"<name>","email":"<email>","pwd":"<password>"}' -H "Content-Type: application/json"
    • To get details of all the users, run curl localhost:3000/users
    • To get the details of a particular user, run curl localhost:3000/users/_id_
    • To create a new post, run curl localhost:3000/userpost -X POST -d '{"id":"<id>","caption":"<caption>","imageurl":"<url>"}' -H "Content-Type: application/json"
    • To get details of all the posts on the feed, run curl localhost:3000/posts
    • To get all the posts of a particular user, run curl localhost:3000/users/_id_

Sample images:

Fetching all available Users

Creating a new User

Users in MongoDB

Fetching User using ID

Creating A Post

Posts in db

Similar Resources

REST API for a shoe store using Go and Gin Web Framework

REST API for a shoe store using Go and Gin Web Framework This API uses a local PostgreSQL database that's set through the /gopostgres/driverConfig.go

Dec 26, 2021

Sample Go REST API implementation with DDD using Clean Architecture.

This layer is a part developed for client-side (mobile, web, etc.) applications to access our domain. It will forward the requests from this layer to the application layer and expose the response it receives from the application layer.

Jan 3, 2023

Rest API Product using Postgre as RDBMS

Rest API Product using Postgre as RDBMS

API Specification General info This is Rest API Product using Postgre as RDBMS. Tools? Please read the go.mod file. DDL CREATE TABLE products ( id bp

Nov 5, 2021

Demo application to implement a REST api backend service for an android app using the Go aah framework.

aah-recycleview-backend This tutorial is based on the aah framework to implement a REST API form of CRUD application services, taking "IN-MEMORY" stor

Jan 28, 2022

Ecommerce-api - Rest api of e-commerce web application

Ecommerce-api - Rest api of e-commerce web application

E-commerce Rest API Swagger documentation to test api Domain diagram

Jan 2, 2023

Simple vanilla Go CRUD application with mongoDB database with its mflix dataset that I use for my thesis about benchmarking REST API and GraphQL.

Go GraphQL Simple vanilla Go CRUD application with mongoDB database with its mflix dataset that I use for my thesis about benchmarking REST API and Gr

Oct 15, 2021

REST API with Echo Framework and a JSON File

 REST API with Echo Framework and a JSON File

REST API with Echo Framework and a JSON File Run it in ./src with: go run server.go The documentation, here = echo.labstack.com. Fake data = mockar

Dec 27, 2021

A simple app that reads NBMiner status REST API data and sends it to InfluxDB

NBMiner Reporter A simple Go app that reads NBMiner status REST API data and sends it to InfluxDB. Usage Using the reporter is quite easy, specially i

Feb 8, 2022

REST API written in GO with PostgreSQL and Nginx Proxy + Certbot Let's Encrypt HTTPS certificates + Graphical Frontend in PHP. Deployed via docker-compose.

SSOA-PT REST APP Services Backend: REST API in Go Database: PostgreSQL Web Proxy: Nginx Let's Encrypt HTTPS certificates with certbot Frontend: PHP Ap

Mar 19, 2022
Echo-mongo-api - Simple Golang REST application with Echo Framework & MongoDB

Echo-mongo-api - Simple Golang REST application with Echo Framework & MongoDB

Feb 14, 2022
Go-gin-mongo-api - A backend RESTful API built using golang, gin and mongoDB

go-gin-mongo-API This is a RESTful backend API which is developed using the gola

Jul 19, 2022
Package GoEagi provides some fundamental functionalities that work with Asterisk's EAGI

GoEagi Package GoEagi provides some fundamental functionalities that work with Asterisk's EAGI. It has the following features: Audio Streaming Google'

Dec 16, 2022
A fully-featured REST API developed in Golang for an online book store.

A fully-featured REST API developed in Golang for an online book store.

Oct 20, 2022
A fully-featured REST API developed in Golang for an online book store.

E-book Store A fully-featured REST API developed in Golang for an online book store. API Documentation Features Authentication (Sign up, Login and Res

Oct 20, 2022
Go (Golang) API REST with Gin FrameworkGo (Golang) API REST with Gin Framework

go-rest-api-aml-service Go (Golang) API REST with Gin Framework 1. Project Description Build REST APIs to support AML service with the support of exte

Nov 21, 2021
Go-service-gin - Simple Web api application developed in Golang and Gin

Simple Web api application developed in Golang and Gin Initial Tutorial URL http

Jan 4, 2022
A Golang REST API to handle users and posts for a simple instagram backend. Uses MongoDB as the database. Tested using golang-testing and Postman.
A Golang REST API to handle users and posts for a simple instagram backend. Uses MongoDB as the database. Tested using golang-testing and Postman.

A Golang REST API to handle users and posts for a simple instagram backend. Uses MongoDB as the database. Tested using golang-testing and Postman.

Oct 10, 2021
GinGoExample - Implement rest api using gin and go and mongodb

GinGoExample Implement rest api using gin and go and mongodb Optimizations using Singlton pattern to avoid repetetive commiunication with mongodb . Fe

Mar 25, 2022
GoVWA - A web application developed to help the pentester and programmers to learn the vulnerabilities

GoVWA - A web application developed to help the pentester and programmers to learn the vulnerabilities

Feb 12, 2022