Skip to content

Commit

Permalink
doc(main): Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ekkinox committed Mar 30, 2024
1 parent f2c7551 commit 1b99d48
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 52 deletions.
65 changes: 31 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,53 @@
> HTTP application template based on the [Yokai](https://github.com/ankorstore/yokai) Go framework.
<!-- TOC -->
* [Overview](#overview)
* [Documentation](#documentation)
* [Overview](#overview)
* [Layout](#layout)
* [Makefile](#makefile)
* [Getting started](#getting-started)
* [Installation](#installation)
* [With GitHub](#with-github)
* [With gonew](#with-gonew)
* [Usage](#usage)
* [Contents](#contents)
* [Layout](#layout)
* [Makefile](#makefile)
<!-- TOC -->

## Documentation

For more information about the [Yokai](https://github.com/ankorstore/yokai) framework, you can check its [documentation](https://ankorstore.github.io/yokai).

## Overview

This template provides:

- a ready to extend [Yokai](https://github.com/ankorstore/yokai) application, with the [fxhttpserver](https://github.com/ankorstore/yokai/tree/main/fxhttpserver) module installed
- a ready to extend [Yokai](https://github.com/ankorstore/yokai) application, with the [HTTP server](https://ankorstore.github.io/yokai/modules/fxhttpserver/) module installed
- a ready to use [dev environment](docker-compose.yaml), based on [Air](https://github.com/cosmtrek/air) (for live reloading)
- some examples of [handler](internal/handler/example.go) and [test](internal/handler/example_test.go) to get started

## Documentation
### Layout

This template is following the [recommended project layout](https://go.dev/doc/modules/layout):

- `cmd/`: entry points
- `configs/`: configuration files
- `internal/`:
- `handler/`: handler and test examples
- `bootstrap.go`: bootstrap
- `register.go`: dependencies registration
- `router.go`: routing registration

See [Yokai documentation](https://ankorstore.github.io/yokai).
### Makefile

This template provides a [Makefile](Makefile):

```
make up # start the docker compose stack
make down # stop the docker compose stack
make logs # stream the docker compose stack logs
make fresh # refresh the docker compose stack
make test # run tests
make lint # run linter
```

## Getting started

Expand Down Expand Up @@ -61,30 +85,3 @@ make fresh
Once ready, the application will be available on:
- [http://localhost:8080](http://localhost:8080) for the application HTTP server
- [http://localhost:8081](http://localhost:8081) for the application core dashboard

## Contents

### Layout

This template is following the [standard Go project layout](https://github.com/golang-standards/project-layout):

- `cmd/`: entry points
- `configs/`: configuration files
- `internal/`:
- `handler/`: handler and test examples
- `bootstrap.go`: bootstrap (modules, lifecycles, etc)
- `routing.go`: routing
- `services.go`: dependency injection

### Makefile

This template provides a [Makefile](Makefile):

```
make up # start the docker compose stack
make down # stop the docker compose stack
make logs # stream the docker compose stack logs
make fresh # refresh the docker compose stack
make test # run tests
make lint # run linter
```
12 changes: 6 additions & 6 deletions internal/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ func init() {
// RootDir is the application root directory.
var RootDir string

// Bootstrapper can be used to load modules, options, services and bootstraps your application.
// Bootstrapper can be used to load modules, options, dependencies, routing and bootstraps your application.
var Bootstrapper = fxcore.NewBootstrapper().WithOptions(
// modules
// modules registration
fxhttpserver.FxHttpServerModule,
// routing
ProvideRouting(),
// services
ProvideServices(),
// dependencies registration
Register(),
// routing registration
Router(),
)

// Run starts the application, with a provided [context.Context].
Expand Down
10 changes: 10 additions & 0 deletions internal/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package internal

import (
"go.uber.org/fx"
)

// Register is used to register the application dependencies.
func Register() fx.Option {
return fx.Options()
}
4 changes: 2 additions & 2 deletions internal/routing.go → internal/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"go.uber.org/fx"
)

// ProvideRouting is used to register the application HTTP handlers.
func ProvideRouting() fx.Option {
// Router is used to register the application HTTP middlewares and handlers.
func Router() fx.Option {
return fx.Options(
fxhttpserver.AsHandler("GET", "", handler.NewExampleHandler),
)
Expand Down
10 changes: 0 additions & 10 deletions internal/services.go

This file was deleted.

0 comments on commit 1b99d48

Please sign in to comment.