An Api for Task by Appointy made using go.

AppointyTask API

How to Compile

  • Export All the required environment variables.

  MONGO_URI = Database URI
  PORT = Port to run the server on
  DATABASE_NAME = Database name
  • Navigate to api directory and Run the command.

  go run main.go
  • The server will be running on the port specified using the environment variable PORT.
  • The API will through an runtime error if the environment variables are not set.

Details About the Endpoints

  • [ POST ] /users: To create a new user.

    Checks if the user already exists in the database. If the user does not exist, creates a new user.

    Request Body:

  {
    "_id"       : string,     //Later Converted to Mongo ObjectId
    "name"      : string,
    "username"  : string,
    "password"  : string,
  }
  • [ GET ] /users/{id}: To get a user by id.

    Returns the user with the given id.

    Request Body:

  {
    "_id"       : string,     //Later Converted to Mongo ObjectId
    "name"      : string,
    "username"  : string,
    "password"  : nil,
  }
  • [ POST ] /posts: To create a new post.

    Creates a new post.

    Response :

  {
    "_id"       : string,     //Later Converted to Mongo ObjectId
    "caption"   : string,
    "imageurl"  : string,
    "postedat"  : string,
    "userid"    : mongo.ObectjId,     
  }
  • [ GET ] /posts/{id}: To get a post by id.

    Returns the post with the given id.


    Response :

  {
    "_id"       : string,     //Later Converted to Mongo ObjectId
    "caption"   : string,
    "imageurl"  : string,
    "postedat"  : string,
    "userid"    : mongo.ObectjId,     
  }
  • [ GET ] /posts/users/{uid}: To get all posts by userid.

    For the specified userid, returns the posts of the user based on Page No. and Page Limit.

    Request Body:

  {
    "page"      : int,
    "limit"     : int,
  }

Response :


  [{
    "_id"       : string,     //Later Converted to Mongo ObjectId
    "caption"   : string,
    "imageurl"  : string,
    "postedat"  : string,
    "userid"    : mongo.ObectjId,     
  }, Upto the Page Limit or till the end of the posts]
Owner
Soumya Ranjan Tripathy
Full Stack Developer | Competitive Coder | A curiosity in machine learning and Flutter.
Soumya Ranjan Tripathy
Similar Resources

Bitwise AND on two byte-slices using SIMD instructions

This package provides a vectorised function which performs bitwise AND operation on all pairs of elements in two byte-slices. It detects CPU instruction set and chooses the available best one (AVX512, AVX2, SSE2).

Oct 17, 2022

tenv detects environment variable not using t.Setenv

tenv detects environment  variable not using t.Setenv

tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17

Nov 8, 2022

A go library to manipulate keyboards using libevdev

gokbd About This is an elementary library using libevdev to talk to a keyboard on Linux. It allows snooping the keys pressed as well as typing out key

Jan 19, 2022

Scalable golang ratelimiter using the sliding window algorithm. Currently supports only Redis.

Scalable golang ratelimiter using the sliding window algorithm. Currently supports only Redis.

go-ratelimiter Scalable golang ratelimiter using the sliding window algorithm. Currently supports only Redis. Example usage client := redis.NewClient

Oct 19, 2021

Validates Terraform Plans using TFSEC and OPA

Terraform Plan Validator Validates Terraform Plans using TFSEC and OPA Commands go run main.go check "delete-rg-test.json" "azure" Docker docker build

Jun 3, 2022

Instrumentations of third-party libraries using opentelemetry-go library

OpenTelemetry Go Contributions About This reopsitory hosts instrumentations of the following OpenTelemetry libraries: confluentinc/confluent-kafka-go

Nov 14, 2022

Encriptator using random generated numbers

public-private-key-encrypter Encriptator using random generated numbers The input file must be in one file called 'data.txt' The execution will genera

Oct 15, 2021

Extended library functions using generics in Go.

Just few extended standard library functions for Golang using generics.

Dec 16, 2021

A program to create assembly 8086 strings to print without using any printing/strings related function but only mov-xchg-int and loops

Assembly String builder tool A program to create assembly 8086 strings to print without using any printing/strings related function but only mov-xchg-

Feb 1, 2022
A pluggable linear task engine

noscript A pluggable linear task engine. Great for providing flexible configuration pattern to end users or providing scripting-like functionality to

Oct 23, 2021
🏮Blazing fast URL shortener made with simplicity in mind

klein Blazing fast URL shortener made with simplicity in mind Structures The project is what people would call a "monolith".

Feb 16, 2022
🏮 ― Blazing fast URL shortener made with simplicity in mind

klein Blazing fast URL shortener made with simplicity in mind Run As easy as filling out config/config.yaml and running make. Of course, you need to h

Feb 16, 2022
JIN the coolest fighting game ever made that uses the M.U.G.E.N engine so heres how you can build it

JIN the coolest fighting game ever made that uses the M.U.G.E.N engine so heres how you can build it

Jan 24, 2022
Instagram Backend API Using GO
Instagram Backend API Using GO

InstaCloneGo ⚡ Instagram Backend API Using GO Setup ❄️ go run server.go API END POINTS CREATE USERS :http://localhost:8001/users GET A USER USING ID

Oct 10, 2021
Perforator is a tool for recording performance metrics over subregions of a program using the Linux "perf" interface.

Perforator Perforator is a tool for recording performance metrics over subregions of a program (e.g., functions) using the Linux "perf" interface.

Dec 15, 2022
rxscan provides functionality to scan text to variables using regular expression capture group.

rxscan rxscan provides functionality to scan text to variables using regular expression capture group. This library is still experimental, use at your

Dec 21, 2020
A tool and library for using structural regular expressions.

Structural Regular Expressions sregx is a package and tool for using structural regular expressions as described by Rob Pike (link).

Dec 7, 2022
This project provides some working examples using Go and Hotwire Turbo.

hotwire-golang-website This project provides some working examples using Go the hotwire/turbo library published by basecamp.

Dec 29, 2022
Visualize your Go data structures using graphviz

memviz How would you rather debug a data structure? "Pretty" printed Visual graph (*test.fib)(0xc04204a5a0)({ index: (int) 5, prev: (*test.fib)(0xc0

Dec 22, 2022