mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-04-21 13:40:00 +08:00
Introduce actix web template
Signed-off-by: jinhai <haijin.chn@gmail.com>
This commit is contained in:
parent
90444f39c0
commit
6ad8d5799b
@ -6,5 +6,9 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix = "0.13.1"
|
actix-web = "4.3.1"
|
||||||
|
actix-rt = "2.8.0"
|
||||||
postgres = "0.19.7"
|
postgres = "0.19.7"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "doc_gpt"
|
20
src/main.rs
20
src/main.rs
@ -1,3 +1,19 @@
|
|||||||
fn main() {
|
use actix_web::{get, web, App, HttpServer, Responder};
|
||||||
println!("Hello, world!");
|
|
||||||
|
#[get("/")]
|
||||||
|
async fn index() -> impl Responder {
|
||||||
|
"Hello, World!"
|
||||||
|
}
|
||||||
|
|
||||||
|
#[get("/{name}")]
|
||||||
|
async fn hello(name: web::Path<String>) -> impl Responder {
|
||||||
|
format!("Hello {}!", &name)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[actix_web::main]
|
||||||
|
async fn main() -> std::io::Result<()> {
|
||||||
|
HttpServer::new(|| App::new().service(index).service(hello))
|
||||||
|
.bind(("127.0.0.1", 9090))?
|
||||||
|
.run()
|
||||||
|
.await
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user