mainmatter/gerust

Qualify routes with module instead of renaming in router.rs

Closed this issue · 0 comments

Currently, Gerust gerates a routers module that renames imported routes. Instead, it should import just the modules the routes live in, and qualify the routes given the module name.

E.g.

use crate::controllers::tasks::{
    create as create_task, create_batch as create_tasks, delete as delete_task,
    read_all as get_tasks, read_one as get_task, update as update_task,
};

becomes

use crate::controllers::tasks;

and

 Router::new()
        .route("/tasks", post(create_task))
        .route("/tasks", put(create_tasks))

becomes

 Router::new()
        .route("/tasks", post(tasks::create))
        .route("/tasks", put(tasks::create_batch))

to avoid confusion.