mirror of
https://github.com/actix/actix-website
synced 2025-06-27 07:29:02 +02:00
Added basic example with includes
This commit is contained in:
6
examples/application/Cargo.toml
Normal file
6
examples/application/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "application"
|
||||
version = "0.1.0"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "0.6"
|
15
examples/application/src/main.rs
Normal file
15
examples/application/src/main.rs
Normal file
@ -0,0 +1,15 @@
|
||||
extern crate actix_web;
|
||||
use actix_web::{App, Responder, HttpRequest, http::Method};
|
||||
|
||||
// <setup>
|
||||
fn index(req: HttpRequest) -> impl Responder {
|
||||
"Hello world!"
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let app = App::new()
|
||||
.prefix("/app")
|
||||
.resource("/index.html", |r| r.method(Method::GET).f(index))
|
||||
.finish();
|
||||
}
|
||||
// </setup>
|
Reference in New Issue
Block a user