Git Product home page Git Product logo

boilerplate's Introduction

GoFiber Docker Boilerplate

Release Discord Test Security Linter

IDE Development

Visual Studio Code

Use the following plugins, in this boilerplate project:

Development

Start the application

go run app.go

Use local container

# Shows all commands
make help

# Clean packages
make clean-packages

# Generate go.mod & go.sum files
make requirements

# Generate docker image
make build

# Generate docker image with no cache
make build-no-cache

# Run the projec in a local container
make up

# Run local container in background
make up-silent

# Run local container in background with prefork
make up-silent-prefork

# Stop container
make stop

# Start container
make start

Production

docker build -t gofiber .
docker run -d -p 3000:3000 gofiber ./app -prod

Go to http://localhost:3000:

Go Fiber Docker Boilerplate

boilerplate's People

Contributors

arjunbiyani avatar daveteu avatar dependabot[bot] avatar eeap avatar efectn avatar fenny avatar gaby avatar github-actions[bot] avatar jianyuan avatar kiyonlin avatar lol3rrr avatar m3rashid avatar mpolinowski avatar ooguz avatar pnutmath avatar renewerner87 avatar shair17 avatar slompo avatar ujprasad avatar whitekeep 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

boilerplate's Issues

More showcase coverage?

First of all, thanks for providing this truly helpful project, so that people like me can learn how a gofiber based web app can/should be architected. I'm still in the process of wrapping my head around how things work, and would appreciate if the following use-cased can be covered as well.

  • Serving dynamic content based on local static file. The key is the separation, I want to code my .html part in .html as much as possible, instead of writing them in .go. So far I am still not sure how to do it with gofiber, so would you provide a sample usage code please? I think the easiest way is to link each added user to a new GET page, where the dynamic content is served based on a local static user.html file.
  • Showcase of redirect. I want my / page a redirect one, so that I can easily redirect to /v2/ if things are ready. So maybe rename static/public/index.html as static/public/index-v1.html and redirect to it from / page?

Thanks for considerations/helps.

HTTP ERR_EMPTY_RESPONSE

The current app.go sometimes doesn't bind to 0.0.0.0 but rather, binds to 127.0.0.1 which will not work with requests from outside the container when the port is exposed i.e. docker run .. -p 3000:3000.

To fix this, in app.go Line 32 change listen from

app.Listen(3000)

to:

app.Listen("0.0.0.0:3000")

About the Dockerfile

First, I want to thank you for sharing this boilerplate. I just started to get to know Fiber and this was a great help. Thank you so much!

I did find the Dockerfile you are using a bit complicated - I know it is an example from the Docker documentation and it does work. The first problem that I ran into was that the image generated in the second step - in the scope of my Docker abilities - could not be renamed. So I always ended up with a generic ID (makes it a bit more complicated to add the image into a Docker-Compose or Kubernetes workflow). And then there is the issue of keeping the container running in the background.

Is there a reason behind the setup you choose that I am not seeing? Or is this a better solution:

https://github.com/mpolinowski/boilerplate

does builderplate code handle zero allocations correctly?

Hi there, I just got started with Fiber today. My own experiments worked fine, but trying out this boilerplate app looked wrong. When entering a couple of user names and then doing a reload the list seem to be the same strings with varying length. That looks to me that the buffer is not handled correctly.

changing the following in database.go seems to fix it

func UserCreate(c *fiber.Ctx) error {
	user := &models.User{
		Name: utils.ImmutableString(c.FormValue("user")),
	}
//...

I just wanted to confirm that this is correct and the right place - and I'm not missing something blindingly obvious as a beginner

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.