diff --git a/src/web/routes/api/mod.rs b/src/web/routes/api/mod.rs index eb144fc..9e0711e 100644 --- a/src/web/routes/api/mod.rs +++ b/src/web/routes/api/mod.rs @@ -1,12 +1,13 @@ -pub mod webhooks; +mod webhooks; -use actix_web::Scope; +use actix_web::{web, HttpResponse, Scope}; pub fn get_scope() -> Scope { Scope::new("/api") + .route("/", web::get().to(HttpResponse::Ok)) .service( webhooks::get_scope() ) diff --git a/src/web/routes/api/webhooks/github/mod.rs b/src/web/routes/api/webhooks/github/mod.rs index 83342b7..2059d4e 100644 --- a/src/web/routes/api/webhooks/github/mod.rs +++ b/src/web/routes/api/webhooks/github/mod.rs @@ -3,14 +3,15 @@ pub mod events; use std::{borrow::BorrowMut, sync::Mutex}; -use actix_web::{http::header, web::{self, Bytes, Data}, HttpRequest, HttpResponse, Resource, Responder, Result, Scope}; +use actix_web::{http::header, web::{self, Bytes, Data}, HttpRequest, HttpResponse, Responder, Result, Scope}; use crate::database::{models, Database}; -pub fn get_scope() -> Resource { - web::resource("/").route( - web::route().to(handler) - ) +pub fn get_scope() -> Scope { + Scope::new("/github") + .route("/", web::get().to(HttpResponse::Ok)) + .route("/", web::post().to(handler)) + } pub async fn handler(req: HttpRequest, body: Bytes, db: Data>) -> Result { diff --git a/src/web/routes/api/webhooks/mod.rs b/src/web/routes/api/webhooks/mod.rs index c73bbc7..4f97048 100644 --- a/src/web/routes/api/webhooks/mod.rs +++ b/src/web/routes/api/webhooks/mod.rs @@ -1,10 +1,11 @@ -use actix_web::Scope; +use actix_web::{web, HttpResponse, Scope}; pub mod github; pub fn get_scope() -> Scope { Scope::new("/wh") + .route("/", web::get().to(HttpResponse::Ok)) .service( github::get_scope() )