Implement basic city portal logic (and severely deabstract)
- Create a podman compose for Postgres - Implement types and tables for urban data - No longer use a Cargo workspace as there's no point currently - Create query functionality (not mutation yet)
This commit is contained in:
parent
61dd9698bf
commit
c6dd6abaf1
14 changed files with 1704 additions and 150 deletions
45
src/main.rs
45
src/main.rs
|
|
@ -1,3 +1,44 @@
|
|||
fn main() {
|
||||
gateway::start();
|
||||
use async_graphql_axum::{GraphQLRequest, GraphQLResponse};
|
||||
use axum::{
|
||||
Router,
|
||||
routing::{get, post},
|
||||
};
|
||||
use std::net::SocketAddr;
|
||||
|
||||
mod models;
|
||||
mod resolvers;
|
||||
mod schema;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let schema = schema::build_schema().await?;
|
||||
|
||||
let app = Router::new()
|
||||
.route(
|
||||
"/graphql",
|
||||
post({
|
||||
let schema = schema.clone();
|
||||
move |req: GraphQLRequest| async move {
|
||||
GraphQLResponse::from(schema.execute(req.into_inner()).await)
|
||||
}
|
||||
}),
|
||||
)
|
||||
.route(
|
||||
"/graphql",
|
||||
get({
|
||||
let schema = schema.clone();
|
||||
move || async move { axum::Json(schema.sdl()) }
|
||||
}),
|
||||
);
|
||||
|
||||
let addr = SocketAddr::from(([0, 0, 0, 0], 3000));
|
||||
println!("listening on http://{}", addr);
|
||||
|
||||
axum::serve(
|
||||
tokio::net::TcpListener::bind(addr).await.unwrap(),
|
||||
app.into_make_service(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue