Moved routes to versioned prefix

pull/3/head
Jef Roosens 2021-11-24 17:51:52 +01:00
parent d3d3771d22
commit 7aee0282b2
Signed by: Jef Roosens
GPG Key ID: 955C0660072F691F
4 changed files with 15 additions and 14 deletions

View File

@ -17,8 +17,7 @@ use rocket::{
use rocket_sync_db_pools::database; use rocket_sync_db_pools::database;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
pub mod posts; pub mod v1;
pub mod sections;
#[database("postgres_rb")] #[database("postgres_rb")]
pub struct RbDbConn(diesel::PgConnection); pub struct RbDbConn(diesel::PgConnection);
@ -66,23 +65,23 @@ fn rocket() -> _
// .attach(AdHoc::config::<JwtConf>()) // .attach(AdHoc::config::<JwtConf>())
.register("/", catchers![default_catcher]) .register("/", catchers![default_catcher])
.mount( .mount(
"/sections", "/v1/sections",
routes![ routes![
sections::get, v1::sections::get,
sections::create, v1::sections::create,
sections::find, v1::sections::find,
sections::patch, v1::sections::patch,
sections::delete v1::sections::delete
], ],
) )
.mount( .mount(
"/posts", "/v1/posts",
routes![ routes![
posts::get, v1::posts::get,
posts::create, v1::posts::create,
posts::find, v1::posts::find,
posts::patch, v1::posts::patch,
posts::delete v1::posts::delete
], ],
); );

2
src/v1/mod.rs 100644
View File

@ -0,0 +1,2 @@
pub mod posts;
pub mod sections;