Skip to content

Commit

Permalink
Unimplemented routes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusbuffett committed Oct 23, 2020
1 parent f560b4e commit 156f632
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -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.