use super::{Controller, Endpoint, HttpMethod, Router};
impl Router {
pub fn get(&mut self, path: &str, controller: Controller) -> &mut Self {
let endpoint = Endpoint::new(HttpMethod::GET, controller);
self.use_endpoint(path, endpoint);
self
}
pub fn post(&mut self, path: &str, controller: Controller) -> &mut Self {
let endpoint = Endpoint::new(HttpMethod::POST, controller);
self.use_endpoint(path, endpoint);
self
}
pub fn put(&mut self, path: &str, controller: Controller) -> &mut Self {
let endpoint = Endpoint::new(HttpMethod::PUT, controller);
self.use_endpoint(path, endpoint);
self
}
pub fn delete(&mut self, path: &str, controller: Controller) -> &mut Self {
let endpoint = Endpoint::new(HttpMethod::DELETE, controller);
self.use_endpoint(path, endpoint);
self
}
pub fn patch(&mut self, path: &str, controller: Controller) -> &mut Self {
let endpoint = Endpoint::new(HttpMethod::PATCH, controller);
self.use_endpoint(path, endpoint);
self
}
}