Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
ec8d0b5ebc
commit
74ea9ddf79
@ -1,3 +1,2 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
|
members = ["crates/*"]
|
||||||
members = ["src/cmd/scel", "src/lib/scel_core", "src/lib/scel_api"]
|
|
||||||
|
@ -12,5 +12,5 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
|||||||
anyhow = { version = "1.0.66" }
|
anyhow = { version = "1.0.66" }
|
||||||
dotenv = { version = "*" }
|
dotenv = { version = "*" }
|
||||||
|
|
||||||
scel_api = { path = "../../lib/scel_api" }
|
scel_api = { path = "../scel_api" }
|
||||||
scel_core = { path = "../../lib/scel_core" }
|
scel_core = { path = "../scel_core" }
|
@ -22,7 +22,7 @@ use axum::{
|
|||||||
use graphql::{
|
use graphql::{
|
||||||
mutation::MutationRoot, query::QueryRoot, schema::ScelSchema, subscription::SubscriptionRoot,
|
mutation::MutationRoot, query::QueryRoot, schema::ScelSchema, subscription::SubscriptionRoot,
|
||||||
};
|
};
|
||||||
use hyper::{client::HttpConnector, Body, StatusCode, Uri};
|
use reqwest::StatusCode;
|
||||||
use scel_core::App;
|
use scel_core::App;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tower_http::{
|
use tower_http::{
|
||||||
@ -49,8 +49,6 @@ pub struct Server {
|
|||||||
addr: SocketAddr,
|
addr: SocketAddr,
|
||||||
}
|
}
|
||||||
|
|
||||||
type Client = hyper::client::Client<HttpConnector, Body>;
|
|
||||||
|
|
||||||
impl Server {
|
impl Server {
|
||||||
pub fn new(app: Arc<App>) -> Server {
|
pub fn new(app: Arc<App>) -> Server {
|
||||||
let schema = Schema::build(QueryRoot, MutationRoot, SubscriptionRoot)
|
let schema = Schema::build(QueryRoot, MutationRoot, SubscriptionRoot)
|
||||||
@ -83,7 +81,6 @@ impl Server {
|
|||||||
.fallback(get_service(ServeDir::new("./src/web/dist/")).handle_error(handle_error))
|
.fallback(get_service(ServeDir::new("./src/web/dist/")).handle_error(handle_error))
|
||||||
.layer(Extension(schema))
|
.layer(Extension(schema))
|
||||||
.layer(Extension(MemoryStore::new()))
|
.layer(Extension(MemoryStore::new()))
|
||||||
.layer(Extension(Client::new()))
|
|
||||||
.layer(Extension(auth::oauth_client()))
|
.layer(Extension(auth::oauth_client()))
|
||||||
.layer(
|
.layer(
|
||||||
CorsLayer::new()
|
CorsLayer::new()
|
||||||
@ -93,9 +90,7 @@ impl Server {
|
|||||||
)
|
)
|
||||||
.layer(TraceLayer::new_for_http().make_span_with(DefaultMakeSpan::default()));
|
.layer(TraceLayer::new_for_http().make_span_with(DefaultMakeSpan::default()));
|
||||||
|
|
||||||
let app = Router::new()
|
let app = Router::new().nest("/api", api_router);
|
||||||
.nest("/api", api_router)
|
|
||||||
.fallback(svc)
|
|
||||||
|
|
||||||
let addr = SocketAddr::from(([0, 0, 0, 0], 3000));
|
let addr = SocketAddr::from(([0, 0, 0, 0], 3000));
|
||||||
|
|
0
src/web/.gitignore → web/.gitignore
vendored
0
src/web/.gitignore → web/.gitignore
vendored
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Loading…
Reference in New Issue
Block a user