appointy-technical-task

command module
v0.0.0-...-7ef27f9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2021 License: MIT Imports: 2 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL