1
0
mirror of https://github.com/actix/examples synced 2024-12-03 18:22:14 +01:00

restructure folders

This commit is contained in:
Rob Ede 2022-02-18 02:01:48 +00:00
parent 4d8573c3fe
commit cc3d356209
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
201 changed files with 52 additions and 49 deletions

1
Cargo.lock generated
View File

@ -5279,6 +5279,7 @@ dependencies = [
"actix-files", "actix-files",
"actix-web", "actix-web",
"env_logger", "env_logger",
"log",
] ]
[[package]] [[package]]

View File

@ -1,60 +1,60 @@
[workspace] [workspace]
members = [ members = [
"auth/casbin",
"auth/cookie-auth",
"auth/cookie-session",
"auth/redis-session",
"auth/simple-auth-server",
"basics/basics", "basics/basics",
"basics/docker_sample",
"basics/error_handling", "basics/error_handling",
"basics/hello-world", "basics/hello-world",
"basics/json-validation", "basics/json-validation",
"basics/middleware-ext-mut",
"basics/middleware-http-to-https",
"basics/middleware",
"basics/nested-routing", "basics/nested-routing",
"basics/shutdown-server",
"basics/state", "basics/state",
"basics/static_index", "basics/static_index",
"basics/todo", "basics/todo",
"database_interactions/basic", "cors/backend",
"data_factory",
# example uses incompatible libsqlite-sys to other examples # example uses incompatible libsqlite-sys to other examples
# "database_interactions/diesel", # "databases/diesel",
"database_interactions/mongodb", "databases/mongodb",
"database_interactions/pg", "databases/postgres",
"database_interactions/redis", "databases/redis",
"database_interactions/simple-auth-server", "databases/sqlite",
"docker",
"forms/form", "forms/form",
"forms/multipart-s3", "forms/multipart-s3",
"forms/multipart", "forms/multipart",
"graphql/async-graphql", "graphql/async-graphql",
"graphql/juniper-advanced", "graphql/juniper-advanced",
"graphql/juniper", "graphql/juniper",
"http-proxy",
"https-tls/awc_https",
"https-tls/openssl-auto-le",
"https-tls/openssl",
"https-tls/rustls-client-cert",
"https-tls/rustls",
"json/json_decode_error", "json/json_decode_error",
"json/json_error", "json/json_error",
"json/json", "json/json",
"json/jsonrpc", "json/jsonrpc",
"other/data_factory", "middleware/middleware-ext-mut",
"other/http-proxy", "middleware/middleware-http-to-https",
"other/protobuf", "middleware/middleware",
"other/run-in-thread", "protobuf",
"other/server-sent-events", "run-in-thread",
"other/unix-socket", "server-sent-events",
"security/awc_https", "shutdown-server",
"security/casbin", "templating/askama",
"security/openssl", "templating/handlebars",
"security/openssl-auto-le", "templating/sailfish",
"security/rustls-client-cert", "templating/tera",
"security/rustls", "templating/tinytemplate",
"security/web-cors/backend", "templating/yarte",
"session/cookie-auth", "unix-socket",
"session/cookie-session",
"session/redis-session",
"template_engines/askama",
"template_engines/handlebars",
"template_engines/tera",
"template_engines/tinytemplate",
"template_engines/yarte",
"template_engines/sailfish",
"websockets/autobahn", "websockets/autobahn",
"websockets/chat",
"websockets/chat-broker", "websockets/chat-broker",
"websockets/chat-tcp", "websockets/chat-tcp",
"websockets/chat",
"websockets/echo", "websockets/echo",
] ]

View File

@ -2,7 +2,6 @@
name = "simple-auth-server" name = "simple-auth-server"
version = "1.0.0" version = "1.0.0"
edition = "2021" edition = "2021"
workspace = "../.."
[dependencies] [dependencies]
actix-web = "4.0.0-beta.21" actix-web = "4.0.0-beta.21"

View File

@ -1,2 +0,0 @@
# Auto detect text files and perform LF normalization
* text=auto

View File

@ -4,6 +4,7 @@ version = "1.0.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
actix-web = "4.0.0-rc.1" actix-web = "4.0.0-rc.3"
actix-files = "0.6.0-beta.15" actix-files = "0.6.0-beta.15"
env_logger = "0.9.0" env_logger = "0.9.0"
log = "0.4"

View File

@ -1,15 +1,14 @@
use actix_files::Files; use actix_files::Files;
use actix_web::{middleware, App, HttpServer}; use actix_web::{middleware::Logger, App, HttpServer};
#[actix_web::main] #[actix_web::main]
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "actix_web=info"); env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
env_logger::init();
log::info!("starting HTTP server at http://localhost:8080");
HttpServer::new(|| { HttpServer::new(|| {
App::new() App::new()
// Enable the logger.
.wrap(middleware::Logger::default())
// We allow the visitor to see an index of the images at `/images`. // We allow the visitor to see an index of the images at `/images`.
.service(Files::new("/images", "static/images/").show_files_listing()) .service(Files::new("/images", "static/images/").show_files_listing())
// Serve a tree of static files at the web root and specify the index file. // Serve a tree of static files at the web root and specify the index file.
@ -17,6 +16,8 @@ async fn main() -> std::io::Result<()> {
// resolved in the order they are defined. If this would be placed before the `/images` // resolved in the order they are defined. If this would be placed before the `/images`
// path then the service for the static images would never be reached. // path then the service for the static images would never be reached.
.service(Files::new("/", "./static/root/").index_file("index.html")) .service(Files::new("/", "./static/root/").index_file("index.html"))
// Enable the logger.
.wrap(Logger::default())
}) })
.bind(("127.0.0.1", 8080))? .bind(("127.0.0.1", 8080))?
.run() .run()

View File

@ -1 +0,0 @@
DATABASE_URL=test.db

View File

@ -1,5 +0,0 @@
People developing rbatis have an example on usage with Actix Web.
<br/>
You can find the example in the [rbatis/example/src/actix_web](https://github.com/rbatis/rbatis/blob/master/example/src/actix_web/main.rs) directory.
<br/>
Tutorial on how to get started with the example is placed inside of the [rbatis/example](https://github.com/rbatis/rbatis/tree/master/example) directory

View File

@ -0,0 +1,5 @@
The `rbatis` ORM developers keep their own example on usage with Actix Web.
You can find the example in the [rbatis/example/src/actix_web](https://github.com/rbatis/rbatis/blob/master/example/src/actix_web/main.rs) directory.
See the [`example` folder readme](https://github.com/rbatis/rbatis/tree/master/example) for a guide on how to get started with the example.

Some files were not shown because too many files have changed in this diff Show More