fixed compilation errors
This commit is contained in:
12
src/main.rs
12
src/main.rs
@@ -1,12 +1,20 @@
|
||||
use actix_web::{web, App, HttpRequest, HttpServer, Responder};
|
||||
include!("handlers/locations.rs");
|
||||
|
||||
async fn index() -> impl Responder { "Connection successful" }
|
||||
async fn index(req: HttpRequest) -> impl Responder { "Connection successful" }
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
HttpServer::new(|| {
|
||||
App::new()
|
||||
.service(web::resource("/").to(index))
|
||||
.route("/", web::get().to(index))
|
||||
.service(
|
||||
web::scope("/api/v1")
|
||||
.service(web::resource("/locations").to(|| {
|
||||
get_locations()
|
||||
}))
|
||||
.service(web::resource("/locations").route(web::post().to(create_location)))
|
||||
)
|
||||
})
|
||||
.bind("127.0.0.1:8080")?
|
||||
.run()
|
||||
|
||||
Reference in New Issue
Block a user