|
| 1 | +# Yokai HTTP Template |
| 2 | + |
| 3 | +[](https://opensource.org/licenses/MIT) |
| 4 | +[](https://go.dev/) |
| 5 | + |
| 6 | +> HTTP application template based on the [Yokai](https://github.com/ankorstore/yokai) Go framework. |
| 7 | +
|
| 8 | +<!-- TOC --> |
| 9 | +* [Documentation](#documentation) |
| 10 | +* [Overview](#overview) |
| 11 | + * [Layout](#layout) |
| 12 | + * [Makefile](#makefile) |
| 13 | +* [Getting started](#getting-started) |
| 14 | + * [Installation](#installation) |
| 15 | + * [With GitHub](#with-github) |
| 16 | + * [With gonew](#with-gonew) |
| 17 | + * [Usage](#usage) |
| 18 | +<!-- TOC --> |
| 19 | + |
| 20 | +## Documentation |
| 21 | + |
| 22 | +For more information about the [Yokai](https://github.com/ankorstore/yokai) framework, you can check its [documentation](https://ankorstore.github.io/yokai). |
| 23 | + |
| 24 | +## Overview |
| 25 | + |
| 26 | +This template provides: |
| 27 | + |
| 28 | +- a ready to extend [Yokai](https://github.com/ankorstore/yokai) application, with the [HTTP server](https://ankorstore.github.io/yokai/modules/fxhttpserver/) module installed |
| 29 | +- a ready to use [dev environment](docker-compose.yaml), based on [Air](https://github.com/cosmtrek/air) (for live reloading) |
| 30 | +- a ready to use [Dockerfile](Dockerfile) for production |
| 31 | +- some examples of [handler](internal/handler/example.go) and [test](internal/handler/example_test.go) to get started |
| 32 | + |
| 33 | +### Layout |
| 34 | + |
| 35 | +This template is following the [recommended project layout](https://go.dev/doc/modules/layout#server-project): |
| 36 | + |
| 37 | +- `cmd/`: entry points |
| 38 | +- `configs/`: configuration files |
| 39 | +- `internal/`: |
| 40 | + - `handler/`: HTTP handler and test examples |
| 41 | + - `bootstrap.go`: bootstrap |
| 42 | + - `register.go`: dependencies registration |
| 43 | + - `router.go`: routing registration |
| 44 | + |
| 45 | +### Makefile |
| 46 | + |
| 47 | +This template provides a [Makefile](Makefile): |
| 48 | + |
| 49 | +``` |
| 50 | +make up # start the docker compose stack |
| 51 | +make down # stop the docker compose stack |
| 52 | +make logs # stream the docker compose stack logs |
| 53 | +make fresh # refresh the docker compose stack |
| 54 | +make test # run tests |
| 55 | +make lint # run linter |
| 56 | +``` |
| 57 | + |
| 58 | +## Getting started |
| 59 | + |
| 60 | +### Installation |
| 61 | + |
| 62 | +#### With GitHub |
| 63 | + |
| 64 | +You can create your repository [using the GitHub template](https://github.com/new?template_name=yokai-http-template&template_owner=ankorstore). |
| 65 | + |
| 66 | +It will automatically rename your project resources and push them, this operation can take a few minutes. |
| 67 | + |
| 68 | +Once ready, after cloning and going into your repository, simply run: |
| 69 | + |
| 70 | +```shell |
| 71 | +make fresh |
| 72 | +``` |
| 73 | + |
| 74 | +#### With gonew |
| 75 | + |
| 76 | +You can install [gonew](https://go.dev/blog/gonew), and simply run: |
| 77 | + |
| 78 | +```shell |
| 79 | +gonew github.com/ankorstore/yokai-http-template github.com/foo/bar |
| 80 | +cd bar |
| 81 | +make fresh |
| 82 | +``` |
| 83 | + |
| 84 | +### Usage |
| 85 | + |
| 86 | +Once ready, the application will be available on: |
| 87 | +- [http://localhost:8080](http://localhost:8080) for the application HTTP server |
| 88 | +- [http://localhost:8081](http://localhost:8081) for the application core dashboard |
0 commit comments