first draft of an interface with frontend

This commit is contained in:
2019-06-18 16:01:56 +02:00
parent f619f7229b
commit f00105aaa5

View File

@@ -5,6 +5,38 @@ extern crate lootalot_db;
use actix_web::{fs, server, App, HttpRequest, Result}; use actix_web::{fs, server, App, HttpRequest, Result};
use std::env; use std::env;
mod api {
use actix_web::{Result, Json};
struct Player;
struct Item;
fn player_list() -> Result<Json<Vec<Player>>> {
let players: Vec<Player> = Vec::new();
Ok(Json(players))
}
fn player_info(_id: i32) -> Result<Json<Player>> {
let player = Player;
Ok(Json(player))
}
fn chest_content(_id: i32) -> Result<Json<Vec<Item>>> {
let items: Vec<Item> = Vec::new();
Ok(Json(items))
}
fn put_request(_player_id: i32, _item_id: i32) -> Result<Json<bool>> {
Ok(Json(false))
}
fn withdraw_request(_player_id: i32, _item_id: i32) -> Result<Json<bool>> {
Ok(Json(false))
}
}
fn main() { fn main() {
println!("Hello, world!"); println!("Hello, world!");