GithubHelp home page GithubHelp logo

diary-api's Introduction

Build a RESTful API using Golang and Gin

Packages

  • Go Cryptography: This provides supplementary Go cryptography libraries.
  • GoDotEnv: This will help with managing environment variables.
  • GORM: This is an ORM (Object Relational Mapper) for Golang. In addition to the library, the GORM dialect (driver) for Postgres is installed to enable connections to PostgreSQL databases.
  • JWT-Go: A Go implementation of JSON Web Tokens.

Installation

It assumes that you meet the prerequisites stated above to follow the steps below:

Clone repository

git clone https://github.com/edujudici/diary-api.git

Running database local

docker run --name postgres_db  -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=diary -d postgres

Running application

go run main.go

Collections

https://documenter.getpostman.com/view/6493792/2s93sgVpmF

Request

# register new user
POST: http://localhost:8000/register

# login with user and pass
# return jwt token
POST: http://localhost:8000/login

Example payload to register/login
    {
        "username": "userfortest",
        "password": "passfortest"
    }
# get all entries, set Bearer Token
GET: http://localhost:8008/api/entry

# create entry, set Bearer Token
POST: http://localhost:8008/api/entry
    {
        "content": "content here"
    }

License


MIT

diary-api's People

Contributors

edujudici 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.