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};
|
use actix_web::{HttpRequest, Responder};
|
||||||
|
|
||||||
pub fn index(_req: &HttpRequest) -> impl Responder {
|
pub fn index(_req: HttpRequest) -> impl Responder {
|
||||||
"Hello world!"
|
"Hello get!"
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn hub(_req: HttpRequest) -> impl Responder {
|
||||||
|
"Hello post!"
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
extern crate actix_web;
|
extern crate actix_web;
|
||||||
extern crate clap;
|
extern crate clap;
|
||||||
use clap::{Arg};
|
use clap::{Arg};
|
||||||
use actix_web::{server, App};
|
use actix_web::{server, App, http};
|
||||||
|
|
||||||
mod controllers;
|
mod controllers;
|
||||||
|
|
||||||
|
@ -30,7 +30,9 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("[rustyhub] Starting server");
|
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))
|
.bind(format!("{}:{}", address, port))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.run();
|
.run();
|
||||||
|
|
Loading…
Reference in New Issue