Added project structure to README

master
Jef Roosens 2021-03-11 12:16:28 +01:00
parent 25eaf77713
commit 1ff5682fd9
Signed by: Jef Roosens
GPG Key ID: B580B976584B5F30
1 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,19 @@
# rust-api # rust-api
An API written in Rust, which I used to learn the language. An API written in Rust, which I used to learn the language.
## 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.