2018-05-24 10:13:55 -07:00
|
|
|
#![allow(dead_code)]
|
|
|
|
use actix_web::{http::Method, App, HttpRequest};
|
|
|
|
|
2018-07-21 05:21:41 -07:00
|
|
|
fn get_projects(_: &HttpRequest) -> String {
|
2018-05-24 10:13:55 -07:00
|
|
|
unimplemented!()
|
|
|
|
}
|
2018-07-21 05:21:41 -07:00
|
|
|
fn create_project(_: &HttpRequest) -> String {
|
2018-05-24 10:13:55 -07:00
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
fn update_project(_: HttpRequest) -> String {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
2018-07-21 05:21:41 -07:00
|
|
|
fn delete_project(_: &HttpRequest) -> String {
|
2018-05-24 10:13:55 -07:00
|
|
|
unimplemented!()
|
|
|
|
}
|
2018-07-21 05:21:41 -07:00
|
|
|
fn get_tasks(_: &HttpRequest) -> String {
|
2018-05-24 10:13:55 -07:00
|
|
|
unimplemented!()
|
|
|
|
}
|
2018-07-21 05:21:41 -07:00
|
|
|
fn create_task(_: &HttpRequest) -> String {
|
2018-05-24 10:13:55 -07:00
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
fn update_task(_: HttpRequest) -> String {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
fn delete_task(_: HttpRequest) -> String {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// <scope>
|
|
|
|
App::new().scope("/project", |proj_scope| {
|
|
|
|
proj_scope
|
|
|
|
.resource("", |r| {
|
|
|
|
r.method(Method::GET).f(get_projects);
|
|
|
|
r.method(Method::POST).f(create_project)
|
|
|
|
})
|
|
|
|
.resource("/{project_id}", |r| {
|
|
|
|
r.method(Method::PUT).with(update_project);
|
|
|
|
r.method(Method::DELETE).f(delete_project)
|
|
|
|
})
|
|
|
|
.nested("/{project_id}/task", |task_scope| {
|
|
|
|
task_scope
|
|
|
|
.resource("", |r| {
|
|
|
|
r.method(Method::GET).f(get_tasks);
|
|
|
|
r.method(Method::POST).f(create_task)
|
|
|
|
})
|
|
|
|
.resource("/{task_id}", |r| {
|
|
|
|
r.method(Method::PUT).with(update_task);
|
|
|
|
r.method(Method::DELETE).with(delete_task)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
});
|
|
|
|
// </scope>
|
|
|
|
}
|