mirror of
https://github.com/actix/examples
synced 2024-11-23 14:31:07 +01:00
restructure folders
This commit is contained in:
parent
4d8573c3fe
commit
cc3d356209
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -5279,6 +5279,7 @@ dependencies = [
|
||||
"actix-files",
|
||||
"actix-web",
|
||||
"env_logger",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
68
Cargo.toml
68
Cargo.toml
@ -1,60 +1,60 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"auth/casbin",
|
||||
"auth/cookie-auth",
|
||||
"auth/cookie-session",
|
||||
"auth/redis-session",
|
||||
"auth/simple-auth-server",
|
||||
"basics/basics",
|
||||
"basics/docker_sample",
|
||||
"basics/error_handling",
|
||||
"basics/hello-world",
|
||||
"basics/json-validation",
|
||||
"basics/middleware-ext-mut",
|
||||
"basics/middleware-http-to-https",
|
||||
"basics/middleware",
|
||||
"basics/nested-routing",
|
||||
"basics/shutdown-server",
|
||||
"basics/state",
|
||||
"basics/static_index",
|
||||
"basics/todo",
|
||||
"database_interactions/basic",
|
||||
"cors/backend",
|
||||
"data_factory",
|
||||
# example uses incompatible libsqlite-sys to other examples
|
||||
# "database_interactions/diesel",
|
||||
"database_interactions/mongodb",
|
||||
"database_interactions/pg",
|
||||
"database_interactions/redis",
|
||||
"database_interactions/simple-auth-server",
|
||||
# "databases/diesel",
|
||||
"databases/mongodb",
|
||||
"databases/postgres",
|
||||
"databases/redis",
|
||||
"databases/sqlite",
|
||||
"docker",
|
||||
"forms/form",
|
||||
"forms/multipart-s3",
|
||||
"forms/multipart",
|
||||
"graphql/async-graphql",
|
||||
"graphql/juniper-advanced",
|
||||
"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_error",
|
||||
"json/json",
|
||||
"json/jsonrpc",
|
||||
"other/data_factory",
|
||||
"other/http-proxy",
|
||||
"other/protobuf",
|
||||
"other/run-in-thread",
|
||||
"other/server-sent-events",
|
||||
"other/unix-socket",
|
||||
"security/awc_https",
|
||||
"security/casbin",
|
||||
"security/openssl",
|
||||
"security/openssl-auto-le",
|
||||
"security/rustls-client-cert",
|
||||
"security/rustls",
|
||||
"security/web-cors/backend",
|
||||
"session/cookie-auth",
|
||||
"session/cookie-session",
|
||||
"session/redis-session",
|
||||
"template_engines/askama",
|
||||
"template_engines/handlebars",
|
||||
"template_engines/tera",
|
||||
"template_engines/tinytemplate",
|
||||
"template_engines/yarte",
|
||||
"template_engines/sailfish",
|
||||
"middleware/middleware-ext-mut",
|
||||
"middleware/middleware-http-to-https",
|
||||
"middleware/middleware",
|
||||
"protobuf",
|
||||
"run-in-thread",
|
||||
"server-sent-events",
|
||||
"shutdown-server",
|
||||
"templating/askama",
|
||||
"templating/handlebars",
|
||||
"templating/sailfish",
|
||||
"templating/tera",
|
||||
"templating/tinytemplate",
|
||||
"templating/yarte",
|
||||
"unix-socket",
|
||||
"websockets/autobahn",
|
||||
"websockets/chat",
|
||||
"websockets/chat-broker",
|
||||
"websockets/chat-tcp",
|
||||
"websockets/chat",
|
||||
"websockets/echo",
|
||||
]
|
||||
|
@ -2,7 +2,6 @@
|
||||
name = "simple-auth-server"
|
||||
version = "1.0.0"
|
||||
edition = "2021"
|
||||
workspace = "../.."
|
||||
|
||||
[dependencies]
|
||||
actix-web = "4.0.0-beta.21"
|
2
basics/static_index/.gitattributes
vendored
2
basics/static_index/.gitattributes
vendored
@ -1,2 +0,0 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
@ -4,6 +4,7 @@ version = "1.0.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "4.0.0-rc.1"
|
||||
actix-web = "4.0.0-rc.3"
|
||||
actix-files = "0.6.0-beta.15"
|
||||
env_logger = "0.9.0"
|
||||
log = "0.4"
|
||||
|
@ -1,15 +1,14 @@
|
||||
use actix_files::Files;
|
||||
use actix_web::{middleware, App, HttpServer};
|
||||
use actix_web::{middleware::Logger, App, HttpServer};
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
std::env::set_var("RUST_LOG", "actix_web=info");
|
||||
env_logger::init();
|
||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||
|
||||
log::info!("starting HTTP server at http://localhost:8080");
|
||||
|
||||
HttpServer::new(|| {
|
||||
App::new()
|
||||
// Enable the logger.
|
||||
.wrap(middleware::Logger::default())
|
||||
// We allow the visitor to see an index of the images at `/images`.
|
||||
.service(Files::new("/images", "static/images/").show_files_listing())
|
||||
// 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`
|
||||
// path then the service for the static images would never be reached.
|
||||
.service(Files::new("/", "./static/root/").index_file("index.html"))
|
||||
// Enable the logger.
|
||||
.wrap(Logger::default())
|
||||
})
|
||||
.bind(("127.0.0.1", 8080))?
|
||||
.run()
|
||||
|
@ -1 +0,0 @@
|
||||
DATABASE_URL=test.db
|
@ -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
|
5
databases/rbatis/README.md
Normal file
5
databases/rbatis/README.md
Normal 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.
|
Can't render this file because it is too large.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user