mirror of
https://github.com/actix/examples
synced 2024-11-23 14:31:07 +01:00
Actix Web
This commit is contained in:
parent
120d33057a
commit
8ae47c8cda
@ -17,7 +17,7 @@
|
||||
- [Nitro Repo](https://github.com/wherkamp/nitro_repo): An open source artifact manager. Rust back-end and Vue front-end.
|
||||
- [Imitari](https://github.com/imitari/imitari): A lightweight ShareX-compatible image uploader server
|
||||
- [mCaptcha](https://github.com/mCaptcha/mCaptcha/): Proof of work based, privacy focused, libre CAPTCHA system. Crates used: `actix-web`, `sqlx`, `redis`, and `lettre`.
|
||||
- [Zero2prod](https://github.com/LukeMathWalker/zero-to-production/): Source code of zero to production series [zero2prod.com](https://www.zero2prod.com). Paid book but some of the chapters is available online for free. The book compares and explains the chosen technologies, like actix-web and sqlx.
|
||||
- [Zero2prod](https://github.com/LukeMathWalker/zero-to-production/): Source code of zero to production series [zero2prod.com](https://www.zero2prod.com). Paid book but some of the chapters is available online for free. The book compares and explains the chosen technologies, like Actix Web and SQLx.
|
||||
- [Triox](https://github.com/Trioxidation/Triox): A free file hosting server that focuses on speed, reliability and security.
|
||||
- [binserve](https://github.com/mufeedvh/binserve): A fast, secure, and easy to set up static web server written on top of Actix Web with routing, templating, and various other features.
|
||||
- [Roseline](https://github.com/DoumanAsh/roseline.rs): A personal web site and discord & IRC bot to access simple SQLite database. Demonstrates usage of various Actix and Actix Web concepts.
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
## Community Articles, Example Apps, Starters & Boilerplate Projects
|
||||
|
||||
- [Jelly Starter](https://github.com/secretkeysio/jelly-actix-web-starter): A starter template for actix-web projects that feels very Django-esque. Avoid the boring stuff and move faster.
|
||||
- [Jelly Starter](https://github.com/secretkeysio/jelly-actix-web-starter): A starter template for Actix Web projects that feels very Django-esque. Avoid the boring stuff and move faster.
|
||||
- [Actix and SQLx User CRUD for MySQL](https://github.com/jamesjmeyer210/actix_sqlx_mysql_user_crud): A User CRUD showcasing MySQL database interaction with full integration test coverage, designed to fit comfortably in a system of micro-services.
|
||||
- [Rust, Actix Web & Heroku](https://github.com/emk/rust-buildpack-example-actix): A Heroku buildpack example for Actix Web.
|
||||
- [webapp.rs](https://github.com/saschagrunert/webapp.rs): A web application completely written in Rust.
|
||||
@ -39,7 +39,7 @@
|
||||
- [Complete Actix 2.x REST Server](https://github.com/ddimaria/rust-actix-example): Actix 2.x HTTP Server featuring multi-database support, auth/JWTs, caching, static files, app state, tests, coverage, and docker.
|
||||
- [Actix Server Authentication with JWT and MongoDB](https://github.com/emreyalvac/actix-web-jwt/): An implementation of JWT in Actix.
|
||||
- [Production-Grade Logging in Rust Applications](https://medium.com/better-programming/production-grade-logging-in-rust-applications-2c7fffd108a6): An article showcasing the use of [tracing](https://github.com/tokio-rs/tracing) in an Actix application
|
||||
- [Fullstack-Rust](https://github.com/vascokk/fullstack-rust): A Full Stack Rust application (Connect5 game) with Actix-web, Yew, Bulma CSS and Diesel.
|
||||
- [Fullstack-Rust](https://github.com/vascokk/fullstack-rust): A Full Stack Rust application (Connect5 game) with Actix Web, Yew, Bulma CSS and Diesel.
|
||||
- [Mozilla Services Skeleton App](https://github.com/mozilla-services/skeleton)
|
||||
|
||||
## Paid Resources
|
||||
|
@ -84,7 +84,7 @@ async fn main() -> io::Result<()> {
|
||||
.wrap(middleware::Compress::default())
|
||||
// cookie session middleware
|
||||
.wrap(CookieSession::signed(&[0; 32]).secure(false))
|
||||
// enable logger - always register actix-web Logger middleware last
|
||||
// enable logger - always register Actix Web Logger middleware last
|
||||
.wrap(middleware::Logger::default())
|
||||
// register favicon
|
||||
.service(favicon)
|
||||
|
@ -1 +1 @@
|
||||
This project illustrates custom error propagation through futures in actix-web
|
||||
This project illustrates custom error propagation through futures in Actix Web.
|
||||
|
@ -1,4 +1,4 @@
|
||||
This is a contrived example intended to illustrate a few important actix-web features.
|
||||
This is a contrived example intended to illustrate a few important Actix Web features.
|
||||
|
||||
*Imagine* that you have a process that involves 3 steps. The steps here
|
||||
are dumb in that they do nothing other than call an HTTP endpoint that
|
||||
@ -10,7 +10,7 @@ Actix Web features illustrated here include:
|
||||
|
||||
1. handling json input param
|
||||
2. validating user-submitted parameters using the 'validator' crate
|
||||
2. actix-web client features:
|
||||
2. `awc` client features:
|
||||
- POSTing json body
|
||||
3. chaining futures into a single response used by an asynch endpoint
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
// This is a contrived example intended to illustrate actix-web features.
|
||||
// This is a contrived example intended to illustrate Actix Web features.
|
||||
// *Imagine* that you have a process that involves 3 steps. The steps here
|
||||
// are dumb in that they do nothing other than call an
|
||||
// httpbin endpoint that returns the json that was posted to it. The intent
|
||||
// here is to illustrate how to chain these steps together as futures and return
|
||||
// a final result in a response.
|
||||
//
|
||||
// Actix-web features illustrated here include:
|
||||
// Actix Web features illustrated here include:
|
||||
// 1. handling json input param
|
||||
// 2. validating user-submitted parameters using the 'validator' crate
|
||||
// 2. actix-web client features:
|
||||
// 2. `awc` client features:
|
||||
// - POSTing json body
|
||||
// 3. chaining futures into a single response used by an async endpoint
|
||||
|
||||
|
@ -3,11 +3,9 @@
|
||||
Demonstrates how to shutdown the web server in a couple of ways:
|
||||
|
||||
1. remotely, via http request
|
||||
- Created in response to actix/actix-web#1315
|
||||
|
||||
2. sending a SIGINT signal to the server (control-c)
|
||||
- actix-server natively supports SIGINT
|
||||
|
||||
- Created in response to actix/actix-web#1315
|
||||
1. sending a SIGINT signal to the server (control-c)
|
||||
- actix-server natively supports SIGINT
|
||||
|
||||
## Usage
|
||||
|
||||
@ -24,6 +22,6 @@ cargo run --bin shutdown-server
|
||||
### Available Routes
|
||||
|
||||
- [GET /hello](http://localhost:8080/hello)
|
||||
- Regular hello world route
|
||||
- Regular hello world route
|
||||
- [POST /stop](http://localhost:8080/stop)
|
||||
- Calling this will shutdown the server and exit
|
||||
- Calling this will shutdown the server and exit
|
||||
|
@ -10,7 +10,7 @@
|
||||
//!
|
||||
//! We retrieve our app state within our handlers with a `state: Data<...>` argument.
|
||||
//!
|
||||
//! By default, `actix-web` runs one [`App`] per logical cpu core.
|
||||
//! By default, Actix Web runs one [`App`] per logical cpu core.
|
||||
//! When running on `<N>` cores, we see that the example will increment `counter_mutex` (global state via
|
||||
//! Mutex) and `counter_atomic` (global state via Atomic variable) each time the endpoint is called,
|
||||
//! but only appear to increment `counter_cell` every Nth time on average (thread-local state). This
|
||||
|
@ -1,4 +1,4 @@
|
||||
Getting started using databases with Actix web, asynchronously.
|
||||
Getting started using databases with Actix Web, asynchronously.
|
||||
|
||||
## Usage
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
People developing rbatis have an example on usage with actix-web.
|
||||
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/>
|
||||
|
@ -1,4 +1,4 @@
|
||||
## Auth Web Microservice with rust using Actix-Web 1.0
|
||||
## Auth Web Microservice with Rust using Actix Web
|
||||
|
||||
### Flow of the event would look like this:
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Actix web juniper example
|
||||
//!
|
||||
//! A simple example integrating juniper in actix-web
|
||||
//! A simple example integrating juniper in Actix Web
|
||||
use std::io;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
A simple demo for building a `JSONRPC over HTTP` server in [actix-web](https://github.com/actix/actix-web).
|
||||
A simple demo for building a `JSONRPC over HTTP` server using [Actix Web](https://github.com/actix/actix-web).
|
||||
|
||||
# Server
|
||||
|
||||
|
@ -10,8 +10,7 @@ Hello world!
|
||||
```
|
||||
|
||||
Although this will only one thread for handling incoming connections
|
||||
according to the
|
||||
[documentation](https://actix.github.io/actix-web/actix_web/struct.HttpServer.html#method.bind_uds).
|
||||
according to the [documentation](https://actix.github.io/actix-web/actix_web/struct.HttpServer.html#method.bind_uds).
|
||||
|
||||
And it does not delete the socket file (`/tmp/actix-uds.socket`) when stopping
|
||||
the server, so it will fail to start next time you run it unless you delete
|
||||
|
@ -12,7 +12,7 @@ async fn main() -> std::io::Result<()> {
|
||||
|
||||
HttpServer::new(|| {
|
||||
App::new()
|
||||
// enable logger - always register actix-web Logger middleware last
|
||||
// enable logger - always register Actix Web Logger middleware last
|
||||
.wrap(middleware::Logger::default())
|
||||
.service(
|
||||
web::resource("/index.html")
|
||||
|
@ -40,7 +40,7 @@ async fn main() -> std::io::Result<()> {
|
||||
.name("auth-example")
|
||||
.secure(false),
|
||||
))
|
||||
// enable logger - always register actix-web Logger middleware last
|
||||
// enable logger - always register Actix Web Logger middleware last
|
||||
.wrap(middleware::Logger::default())
|
||||
.service(web::resource("/login").route(web::post().to(login)))
|
||||
.service(web::resource("/logout").to(logout))
|
||||
|
@ -85,7 +85,7 @@ async fn main() -> std::io::Result<()> {
|
||||
App::new()
|
||||
// redis session middleware
|
||||
.wrap(RedisSession::new("127.0.0.1:6379", &private_key.master()))
|
||||
// enable logger - always register actix-web Logger middleware last
|
||||
// enable logger - always register Actix Web Logger middleware last
|
||||
.wrap(middleware::Logger::default())
|
||||
.service(resource("/").route(get().to(index)))
|
||||
.service(resource("/do_something").route(post().to(do_something)))
|
||||
|
Loading…
Reference in New Issue
Block a user