Skip to content

Online video game back-end using AWS Gamelift with rusoto_gamelift crate #1922

Answered by fakeshadow
Tipnos asked this question in Q&A
Discussion options

You must be logged in to vote
use actix_web::{get, App, HttpServer, web::Data};
use rusoto_gamelift::GameLiftClient;
use rusoto_core::credential::{EnvironmentProvider};
use rusoto_core::request::HttpClient;
use rusoto_core::region::Region;

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    let cred = EnvironmentProvider::default();
    let client = HttpClient::new().unwrap();
    let client = GameLiftClient::new_with(client, cred, Region::EuWest1);

    HttpServer::new(move || App::new().data(client.clone()).service(index))
        .bind("127.0.0.1:8000")?
        .run()
        .await
}

#[get("/")]
async fn index(data: Data<GameLiftClient>) -> &'static str {
    "working!"
}

[dependencies]
actix-web = "…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@Tipnos
Comment options

Comment options

You must be logged in to vote
3 replies
@Tipnos
Comment options

@fakeshadow
Comment options

@Tipnos
Comment options

Answer selected by Tipnos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants