Defining our networking create API endpoint
Our create endpoint for our networking layer takes the following form:
// nanoservices/auth/networking/actix_server/
// src/api/users/create.rs
use auth_dal::users::transactions::create::SaveOne;
use auth_core::api::users::create::{
create as create_core,
CreateUser
};
use auth_dal::users::schema::NewUser;
use glue::errors::NanoServiceError;
use actix_web::{
HttpResponse,
web::Json
};
pub async fn create<T: SaveOne>(body: Json<CreateUser>)
-> Result<HttpResponse, NanoServiceError> {
let _ = create_core::<T>(body.into_inner()).await?;
Ok(HttpResponse::Created().finish())
}
And our create endpoint function is mounted to our server with the code below:
// nanoservices/auth/networking/actix_server/
// src/api/users/mod.rs
pub mod create;
use auth_dal::users::descriptors::SqlxPostGresDescriptor;
use actix_web::web::{ServiceConfig, scope, post};
pub fn users_factory(app: &mut ServiceConfig...