add user table
This commit is contained in:
27
src/rest/mod.rs
Normal file
27
src/rest/mod.rs
Normal file
@ -0,0 +1,27 @@
|
||||
use rocket::{get, routes, Build, Rocket};
|
||||
|
||||
#[get("/")]
|
||||
fn index() -> &'static str {
|
||||
"Hello, world!"
|
||||
}
|
||||
|
||||
pub fn start() -> Rocket<Build> {
|
||||
rocket::build().mount("/", routes![index])
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::start;
|
||||
use rocket::http::Status;
|
||||
use rocket::local::blocking::Client;
|
||||
use rocket::uri;
|
||||
|
||||
#[test]
|
||||
fn hello_world() {
|
||||
let client = Client::tracked(start()).expect("valid rocket instance");
|
||||
let response = client.get(uri!(super::index)).dispatch();
|
||||
|
||||
assert_eq!(response.status(), Status::Ok);
|
||||
assert_eq!(response.into_string(), Some("Hello, world!".into()));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user