treewide: Migrate to clean-architecture
Signed-off-by: supercmmetry <vishaals2000@gmail.com>
This commit is contained in:
parent
810af687c6
commit
da21eb1189
0
src/api/catchers/mod.rs
Normal file
0
src/api/catchers/mod.rs
Normal file
0
src/api/guards/mod.rs
Normal file
0
src/api/guards/mod.rs
Normal file
0
src/api/misc/mod.rs
Normal file
0
src/api/misc/mod.rs
Normal file
5
src/api/mod.rs
Normal file
5
src/api/mod.rs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
pub mod routes;
|
||||||
|
pub mod catchers;
|
||||||
|
|
||||||
|
mod guards;
|
||||||
|
mod misc;
|
11
src/api/routes/health.rs
Normal file
11
src/api/routes/health.rs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
use rocket::Rocket;
|
||||||
|
|
||||||
|
#[get("/check")]
|
||||||
|
fn check() -> &'static str {
|
||||||
|
"OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pub fn fuel(rocket: Rocket) -> Rocket {
|
||||||
|
rocket.mount("/api/health", routes![check])
|
||||||
|
}
|
12
src/api/routes/mod.rs
Normal file
12
src/api/routes/mod.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
use rocket::Rocket;
|
||||||
|
|
||||||
|
pub mod health;
|
||||||
|
|
||||||
|
pub fn fuel(rocket: Rocket) -> Rocket {
|
||||||
|
let mut rocket = rocket;
|
||||||
|
|
||||||
|
rocket = health::fuel(rocket);
|
||||||
|
|
||||||
|
rocket
|
||||||
|
}
|
||||||
|
|
1
src/core/mod.rs
Normal file
1
src/core/mod.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub mod paste;
|
0
src/core/paste/diesel.rs
Normal file
0
src/core/paste/diesel.rs
Normal file
0
src/core/paste/entity.rs
Normal file
0
src/core/paste/entity.rs
Normal file
4
src/core/paste/mod.rs
Normal file
4
src/core/paste/mod.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
pub mod entity;
|
||||||
|
pub mod repository;
|
||||||
|
pub mod diesel;
|
||||||
|
pub mod service;
|
0
src/core/paste/repository.rs
Normal file
0
src/core/paste/repository.rs
Normal file
0
src/core/paste/service.rs
Normal file
0
src/core/paste/service.rs
Normal file
16
src/main.rs
16
src/main.rs
@ -3,13 +3,15 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate rocket;
|
extern crate rocket;
|
||||||
|
|
||||||
#[get("/alive")]
|
pub mod api;
|
||||||
fn alive() -> &'static str {
|
pub mod core;
|
||||||
"OK"
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
rocket::ignite()
|
let mut rocket = rocket::ignite();
|
||||||
.mount("/", routes![index])
|
|
||||||
.launch();
|
rocket = api::routes::fuel(rocket);
|
||||||
|
|
||||||
|
rocket.launch();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user