Added Location and location ownership/rights to gamenight.
This commit is contained in:
@@ -3,19 +3,19 @@ pub mod models;
|
||||
pub mod request;
|
||||
|
||||
use actix_cors::Cors;
|
||||
use actix_web::middleware::Logger;
|
||||
use actix_web::HttpServer;
|
||||
use actix_web::App;
|
||||
use actix_web::http;
|
||||
use actix_web::middleware::Logger;
|
||||
use actix_web::web;
|
||||
use request::{*, login, register, gamenights};
|
||||
use tracing_actix_web::TracingLogger;
|
||||
use actix_web::App;
|
||||
use actix_web::HttpServer;
|
||||
use gamenight_database::*;
|
||||
use request::{gamenights, login, register, *};
|
||||
use tracing_actix_web::TracingLogger;
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
let url = "postgres://root:root@127.0.0.1/gamenight";
|
||||
|
||||
|
||||
let pool = get_connection_pool(url);
|
||||
|
||||
let mut conn = pool.get_conn();
|
||||
@@ -26,11 +26,11 @@ async fn main() -> std::io::Result<()> {
|
||||
HttpServer::new(move || {
|
||||
let cors = Cors::default()
|
||||
.allowed_origin("0.0.0.0")
|
||||
.allowed_origin_fn(|_origin, _req_head| { true })
|
||||
.allowed_methods(vec!["GET", "POST"])
|
||||
.allowed_headers(vec![http::header::AUTHORIZATION, http::header::ACCEPT])
|
||||
.allowed_header(http::header::CONTENT_TYPE)
|
||||
.max_age(3600);
|
||||
.allowed_origin_fn(|_origin, _req_head| true)
|
||||
.allowed_methods(vec!["GET", "POST"])
|
||||
.allowed_headers(vec![http::header::AUTHORIZATION, http::header::ACCEPT])
|
||||
.allowed_header(http::header::CONTENT_TYPE)
|
||||
.max_age(3600);
|
||||
|
||||
App::new()
|
||||
.wrap(cors)
|
||||
@@ -44,6 +44,7 @@ async fn main() -> std::io::Result<()> {
|
||||
.service(gamenight_post)
|
||||
.service(gamenight_get)
|
||||
.service(get_user)
|
||||
.service(get_users)
|
||||
.service(get_user_unauthenticated)
|
||||
.service(post_join_gamenight)
|
||||
.service(post_leave_gamenight)
|
||||
@@ -55,8 +56,12 @@ async fn main() -> std::io::Result<()> {
|
||||
.service(post_own_game)
|
||||
.service(post_disown_game)
|
||||
.service(get_owned_games)
|
||||
.service(get_locations)
|
||||
.service(post_location)
|
||||
.service(post_location_authorize)
|
||||
.service(get_authorized_location_user_ids)
|
||||
})
|
||||
.bind(("::1", 8080))?
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user