Skip to content

Arhimondus/actix-fbr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation:

cargo add Arhimondus/actix-fbr

Example:

main.rs

use actix_web::{Responder, HttpServer, App, web, HttpResponse};
use actix_fbr::{routes, services};

routes!("src/routes");

#[actix_web::main]
async fn main() -> std::io::Result<()> {
	HttpServer::new(|| {
		App::new()
		 	.route("/", web::to(|| async { HttpResponse::Ok().body("index") }))
			.service(services!("src/routes"))
	})
	.bind(("127.0.0.1", 8080))?
	.run()
	.await
}

src/routes/one1.rs

use actix_web::{Responder};

pub async fn get() -> impl Responder {
	"[get] one1"
}

src/routes/one2.rs

use actix_web::{Responder};

pub async fn get() -> impl Responder {
	"[get] one2"
}

Currently limitation

Only first level paths support.

About

Actix-web Filebased Routing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages