2021-03-13 22:11:26 +01:00
|
|
|
# Fej
|
2021-03-04 11:55:24 +01:00
|
|
|
|
2021-03-13 22:11:26 +01:00
|
|
|
Fej is an API written in Rust. I started this project to learn the language,
|
|
|
|
and really just have some fun.
|
2021-03-11 12:16:28 +01:00
|
|
|
|
|
|
|
## Project Structure
|
|
|
|
|
|
|
|
The folder structure follows the structure of the URLs, e.g. the route for
|
|
|
|
`/hello/world` is found in the module `src/hello`.
|
|
|
|
|
|
|
|
Each module contains the following base files:
|
|
|
|
|
|
|
|
* `mod.rs`: defines the modules' content, and contains the route definitions.
|
|
|
|
The route functions themselves only contain the functionality needed to
|
|
|
|
represent the data, not acquire it.
|
|
|
|
* `controller.rs`: this file contains the actual logic of each route. If the
|
|
|
|
logic becomes too complicated to be contained inside a single file,
|
|
|
|
`controller.rs` becomes its own module folder named `controller`.
|
|
|
|
* `tests.rs`: this contains tests for the specific module. This can also be a
|
|
|
|
module directory if need be.
|
2021-03-11 20:52:30 +01:00
|
|
|
|
|
|
|
Every module has a `routes` function that returns its route macros.
|
2021-03-23 13:47:57 +01:00
|
|
|
|
|
|
|
## Roadmap
|
|
|
|
|
|
|
|
See [roadmap.md](roadmap.md).
|
2021-04-13 22:35:39 +02:00
|
|
|
|
|
|
|
## Development
|
|
|
|
|
|
|
|
The entire toolchain runs on Alpine inside Docker. This makes building easier,
|
|
|
|
and (hopefully) eliminates any system-specific bugs.
|
|
|
|
|
|
|
|
A [Makefile wrapper](Makefile) is provided for ease of use. Do check it out, as
|
|
|
|
all the commands are documented for your understanding ;)
|
|
|
|
|
|
|
|
There's also the `build` script. This script does all the "heavy" lifting. It
|
|
|
|
chooses which Dockerfile to build according to the given arguments, and
|
|
|
|
generates tags for the images (useful when pushing releases). The Makefile is
|
|
|
|
really just a wrapper around this build script, allowing you to write
|
|
|
|
`make test` instead of `./build -m dev -a run test`.
|
|
|
|
|
|
|
|
tl;dr run `make run` to run your build, and `make test` to run the tests.
|
2021-04-13 23:55:22 +02:00
|
|
|
|
|
|
|
## Docker images
|
|
|
|
|
|
|
|
The images are available [here](https://hub.docker.com/r/chewingbever/fej).
|