added post route for the hub functionality
This commit is contained in:
parent
f66a16c34c
commit
5d6243ae26
|
@ -1,7 +1,11 @@
|
|||
use actix_web::{HttpRequest, Responder};
|
||||
|
||||
pub fn index(_req: &HttpRequest) -> impl Responder {
|
||||
"Hello world!"
|
||||
pub fn index(_req: HttpRequest) -> impl Responder {
|
||||
"Hello get!"
|
||||
}
|
||||
|
||||
pub fn hub(_req: HttpRequest) -> impl Responder {
|
||||
"Hello post!"
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
extern crate actix_web;
|
||||
extern crate clap;
|
||||
use clap::{Arg};
|
||||
use actix_web::{server, App};
|
||||
use actix_web::{server, App, http};
|
||||
|
||||
mod controllers;
|
||||
|
||||
|
@ -30,7 +30,9 @@ fn main() {
|
|||
}
|
||||
|
||||
println!("[rustyhub] Starting server");
|
||||
server::new(|| App::new().resource("/", |r| r.f(controllers::index)))
|
||||
server::new(|| App::new()
|
||||
.route("/", http::Method::GET, controllers::index)
|
||||
.route("/", http::Method::POST, controllers::hub))
|
||||
.bind(format!("{}:{}", address, port))
|
||||
.unwrap()
|
||||
.run();
|
||||
|
|
Loading…
Reference in New Issue