2017-08-29 03:14:59 +00:00
|
|
|
#![feature(plugin, decl_macro, custom_derive)]
|
2016-10-07 03:38:13 +00:00
|
|
|
#![plugin(rocket_codegen)]
|
2017-09-10 08:19:38 +00:00
|
|
|
#![allow(dead_code, unused_variables)]
|
2016-10-07 03:38:13 +00:00
|
|
|
|
|
|
|
extern crate rocket;
|
|
|
|
|
2017-03-31 06:06:53 +00:00
|
|
|
use rocket::http::{Cookies, RawStr};
|
2016-10-12 07:14:42 +00:00
|
|
|
use rocket::request::Form;
|
2016-10-07 03:38:13 +00:00
|
|
|
|
|
|
|
#[derive(FromForm)]
|
2016-12-21 08:09:22 +00:00
|
|
|
struct User<'a> {
|
2017-03-31 06:06:53 +00:00
|
|
|
name: &'a RawStr,
|
2016-12-21 08:09:22 +00:00
|
|
|
nickname: String,
|
2016-10-07 03:38:13 +00:00
|
|
|
}
|
|
|
|
|
2017-08-03 01:44:31 +00:00
|
|
|
#[post("/<name>?<_query>", format = "application/json", data = "<user>", rank = 2)]
|
2017-03-31 07:18:58 +00:00
|
|
|
fn get<'r>(name: &RawStr,
|
2017-08-03 01:44:31 +00:00
|
|
|
_query: User<'r>,
|
2016-12-21 08:09:22 +00:00
|
|
|
user: Form<'r, User<'r>>,
|
2017-03-07 09:19:06 +00:00
|
|
|
cookies: Cookies)
|
2016-12-21 08:09:22 +00:00
|
|
|
-> &'static str {
|
|
|
|
"hi"
|
|
|
|
}
|
2016-10-07 03:38:13 +00:00
|
|
|
|
2017-09-10 08:19:38 +00:00
|
|
|
#[test]
|
2016-10-07 03:38:13 +00:00
|
|
|
fn main() {
|
|
|
|
let _ = routes![get];
|
|
|
|
}
|