Giter VIP home page Giter VIP logo

massad / gin-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
1.0K 22.0 183.0 200 KB

The fastest way to deploy a restful api's with Gin Framework with a structured project that defaults to PostgreSQL database and JWT authentication middleware stored in Redis

License: MIT License

Go 86.57% HTML 0.99% PLpgSQL 11.50% Shell 0.93%
gin-framework redis golang postgresql boilerplate-template database gin-boilerplate postman jwt ssl

gin-boilerplate's Introduction

Hi there ๐Ÿ‘‹

  • ๐Ÿ”ญ Currently building the awesome mobile app distribution platform

  • ๐ŸŽ‰ Some fun facts

Top Langs

Anurag's GitHub stats

visitor badge since 16 Sep 2021

Are you a mobile app developer? Join our slack

gin-boilerplate's People

Contributors

anshuman-agarwala avatar billmakes avatar brian926 avatar defp avatar gitter-badger avatar kaansk avatar krolow avatar luckspt avatar massad avatar testwill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gin-boilerplate's Issues

Build fails due to myesui/uuid

It looks like the repo https://github.com/myesui/uuid is now missing and https://github.com/twinj/uuid looks to be dependent on it. Thus, some fun errors occur with the modules and when trying to build.

        remote: Repository not found.
        fatal: repository 'https://github.com/myesui/uuid/' not found

An easy solution seems to be replacing https://github.com/twinj/uuid with https://github.com/google/uuid which has the same functionality.

How to actually run the app

So, I installed the database and everything, and it's connected, but there doesn't seem to be any UI...is that an exercise left to the reader?

Doesnt hit the create article endpoint

/**
* TestCreateArticleUnauthorized
* Test getting the article with unauthorized user (wrong or expired access_token)
*
* Must return response code 401
*/
func TestCreateArticleUnauthorized(t *testing.T) {
testRouter := SetupRouter()
req, err := http.NewRequest("GET", fmt.Sprintf("/v1/article/%d", articleID), nil)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", fmt.Sprintf("Bearer: %s", "abc123"))
if err != nil {
fmt.Println(err)
}
resp := httptest.NewRecorder()
testRouter.ServeHTTP(resp, req)
assert.Equal(t, resp.Code, http.StatusUnauthorized)
}

just a question

Probably a very basic and stupid question - but what is the main purpose of having forms and models? Why not to use just models?

Ho to implement authentication?

I'm wondering if I save JWT as httpOnly cookie in browser,will it be secure enough? Or do I need to implement an extra anti-CSRF token to each form?
A sample user user authentication/authorization code will be much appreciated.

Adding article's Tags - request

I wanna use your great boilerplate, but because I'm a newbie Golang developer I have a request, can you please add Tags relationship for the articles. I wanna see how can I implement such things for my demo Restful APIs.

Suggestions for improving gin-boilerplate

As some of the current dependencies are outdated or no longer maintained, gin-boilerplate could benefit from some changes to existing setup. What do you think of making these changes to gin-boilerplate?

  • Add OpenAPI 3.0 support through oapi-codegen for server code generation and documentation support.
  • Replace go-gorp/gorp and pq with sqlc, pgx and use atlas for DB migrations.
    • gorp seems to no longer be maintained as no commits has been made since last year, and pgx is a better maintained alternative than pq these days.

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.