Code Monkey home page Code Monkey logo

fiber-crayplate's Introduction

Fiber Crayplate

A Web JSON API boilerplate for fiber framework, no template no nothing, just plain old backend in JSON. Mostly based on fiber-boilerplate.

Configuration

All configuration for your application can be found in the ./config directory. Various options can be changed depending on your needs such as Database settings, Fiber settings and Fiber Middleware setting such as Logger, and Helmet.

These configurations can be found in different files such as app.yaml, fiber.yaml and template.yaml.

Keep in mind if configurations are not set, they default to Fiber's default settings which can be found here.

Routing

Routing examples can be found within the /routes directory.

Database

Please, please stop using ORM. Go with pgx, or just plain old database/sql ain't that hard.

Hell, here's a powerful SQL string builder if you don't like building your string by yourself,

and there's plenty of migration libraries out there for Go. Here's an example.

JSON Marshal and Unmarshal

Fiber already uses jsoniter by default. I imported it and use it manually cause extending it is more powerful and flexible.

Controllers

Example controllers can be found within the /app/controllers directory. You can extend or edit these to your preferences.

Providers

Providers (custom middleware) can be found at /app/providers. These providers are not automatically registered.

Docker

You can run your own application using the Docker example image. To build and run the Docker image, you can use the following commands.

docker build -t fiber-crayplate .
docker run --name fiber-crayplate -p 3000:3000 fiber-crayplate

Live Reloading (Air)

Example configuration files for Air have also been included. This allows you to live reload your Go application when you change a model, view or controller.

To run Air, use the following commands. Also, check out Air its documentation about running the air command.

# Windows
air -c .air.windows.conf
# Linux
air -c .air.linux.conf

Future Plans

  • Add actual CRUD example instead of just read all rows of users.
  • Auth example using jwt or oauth.
  • Response caching using either memcached or redis.
  • Simple RBAC example persisting in the Database.
  • Maybe a fork with an example of how to serve Single Page Application Frontend. Won't be using any templates though, just plain old index.html with SPA(built) inside served over and over.

fiber-crayplate's People

Contributors

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