Giter Club home page Giter Club logo

go-userapi-rest's Introduction

User Information RESTful API on Go: Fiber, MongoDB Atlas

go-userapi-rest

Description

REST API for a User Information application in which we create new users, view them, update & delete their information. Here I used a NoSQL database MongoDB for storing the data.

Hosted on Heroku

https://go-userapi-rest.herokuapp.com/swagger/index.html (sadly now I have to pay for heroku -> No longer active :-(

Requirements

  • Go 1.18

    Rest of requirements are pulled by go itself. Database is already configured but can be changed.

Installation

  1. Clone the repo

    https://github.com/Guleri24/go-userapi-rest.git

  2. Open go-userapi-rest

    cd go-userapi-rest

  3. Install project dependencies

    go get ./...

  4. Optional: Swagger Docs

    swag init

  5. Run

    go run main.go

User

Create a new user

POST /user (Creates a new user)
Parameters
name type data type description
Body required object (JSON) User obj
Example cURL
 curl -X 'POST' 'https://go-userapi-rest.herokuapp.com/api/v1/user' -H 'accept: application/json' -H 'Content-Type: application/json' -d '{"address": "Guler, Himachal Pradesh","description": "Student@NITH","dob": "24-12-2000","name": "Guleri"}'

Get user by given ID

GET /user/{id} (Get user by given ID)
Parameters
name type data type description
id required string User ID
Example cURL
 curl -X 'GET' 'https://go-userapi-rest.herokuapp.com/api/v1/user/63023e32606a56bdd637c202' -H 'accept: application/json'

Delete user by given ID

DELETE /user/{id} (Deletes a user by given ID)
Parameters
name type data type description
id required string User ID
Example cURL
 curl -X 'DELETE' 'https://go-userapi-rest.herokuapp.com/api/v1/user/63023e32606a56bdd637c202' -H 'accept: application/json'

Edit/Update user

PATCH /user/{id} (Updates a user by given ID)
Parameters
name type data type description
id required string User Id
Body required object(json) User obj
Example cURL
 curl -X 'PATCH' 'https://go-userapi-rest.herokuapp.com/api/v1/user/63000c7aa8079cb65b7478e7' -H 'accept: application/json' -H 'Content-Type: application/json' -d '{"address": "Hostel@DBH","description": "Student@NITH","dob": "24-12-2000","name": "Guleri24"}'

Users

Get all exists users

GET /users (Get all exists users)
Parameters

none

Example cURL
 curl -X 'GET' 'https://go-userapi-rest.herokuapp.com/api/v1/users' -H 'accept: application/json'

go-userapi-rest's People

Contributors

guleri24 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.