1
0
mirror of https://github.com/actix/actix-website synced 2025-06-27 15:39:02 +02:00

Added basic example with includes

This commit is contained in:
Armin Ronacher
2018-05-23 21:28:12 +02:00
parent aebbfbf9db
commit e204566062
6 changed files with 34 additions and 15 deletions

1
examples/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
target

4
examples/Cargo.toml Normal file
View File

@ -0,0 +1,4 @@
[workspace]
members = [
"application",
]

View File

@ -0,0 +1,6 @@
[package]
name = "application"
version = "0.1.0"
[dependencies]
actix-web = "0.6"

View 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>