using custom version of actix-codegen and cors for pow routes

This commit is contained in:
realaravinth
2021-05-25 14:34:24 +05:30
parent 0421cb681c
commit 72667bd2e1
26 changed files with 334 additions and 363 deletions

View File

@@ -45,6 +45,7 @@ pub mod routes {
}
/// emmits build details of the bninary
#[my_codegen::get(path="crate::V1_API_ROUTES.meta.build_details")]
async fn build_details() -> impl Responder {
let build = BuildDetails {
version: VERSION,
@@ -60,6 +61,7 @@ pub struct Health {
}
/// checks all components of the system
#[my_codegen::get(path="crate::V1_API_ROUTES.meta.health")]
async fn health(data: web::Data<Data>) -> impl Responder {
use sqlx::Connection;
@@ -75,16 +77,8 @@ async fn health(data: web::Data<Data>) -> impl Responder {
}
pub fn services(cfg: &mut web::ServiceConfig) {
use crate::define_resource;
use crate::V1_API_ROUTES;
define_resource!(
cfg,
V1_API_ROUTES.meta.build_details,
Methods::Get,
build_details
);
define_resource!(cfg, V1_API_ROUTES.meta.health, Methods::Get, health);
cfg.service(build_details);
cfg.service(health);
}
#[cfg(test)]