Skip to content
Permalink
Browse files
Unimplemented routes
  • Loading branch information
marcusbuffett committed Oct 23, 2020
1 parent f560b4e commit 156f6329dc75c13d6bc30d9be76600eeedede59a
Showing 1 changed file with 36 additions and 0 deletions.
@@ -0,0 +1,36 @@
#![feature(decl_macro)]

#[macro_use]
extern crate rocket;

use rocket_contrib::json::Json;
use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize, Clone)]
struct User {
username: String,
favorite_food: String,
}

type EndpointResult<T> = Result<T, &'static str>;

#[get("/users/<username>")]
fn get_user(username: String) -> EndpointResult<Json<User>> {
todo!()
}

#[delete("/users/<username>")]
fn delete_user(username: String) -> EndpointResult<Json<User>> {
todo!()
}

#[put("/users", data = "<user>")]
fn put_user(user: Json<User>) -> EndpointResult<Json<User>> {
todo!()
}

fn main() {
rocket::ignite()
.mount("/api/", routes![get_user, put_user, delete_user])
.launch();
}

0 comments on commit 156f632

Please sign in to comment.