mirror of
https://github.com/actix/examples
synced 2024-11-27 16:02:57 +01:00
use cors and identity crates
This commit is contained in:
parent
c8467d1ffd
commit
e7ed6755a5
@ -3,7 +3,6 @@
|
|||||||
A curated list of examples related to actix.
|
A curated list of examples related to actix.
|
||||||
|
|
||||||
## from community
|
## from community
|
||||||
* [RutHub](https://www.ruthub.com/): A service for sharing read list powered by actix-web + diesel, [repo](https://github.com/danloh/rut-server-rust).
|
|
||||||
* [OUISRC](http://ouisrc.xyz/) : Welcome to OUISRC, let us Gain more in exploration and interaction.
|
* [OUISRC](http://ouisrc.xyz/) : Welcome to OUISRC, let us Gain more in exploration and interaction.
|
||||||
* [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.
|
* [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.
|
||||||
* [Actix Auth Server](https://hgill.io/posts/auth-microservice-rust-actix-web-diesel-complete-tutorial-part-1/) : Auth web micro-service with rust using actix-web - complete tutorial. See code in [examples/simple-auth-server](https://github.com/actix/examples/tree/master/simple-auth-server)
|
* [Actix Auth Server](https://hgill.io/posts/auth-microservice-rust-actix-web-diesel-complete-tutorial-part-1/) : Auth web micro-service with rust using actix-web - complete tutorial. See code in [examples/simple-auth-server](https://github.com/actix/examples/tree/master/simple-auth-server)
|
||||||
|
@ -7,4 +7,5 @@ workspace = ".."
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0"
|
actix-web = "1.0.0"
|
||||||
|
actix-identity = "0.1.0"
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use actix_web::middleware::identity::Identity;
|
use actix_identity::Identity;
|
||||||
use actix_web::middleware::identity::{CookieIdentityPolicy, IdentityService};
|
use actix_identity::{CookieIdentityPolicy, IdentityService};
|
||||||
use actix_web::{middleware, web, App, HttpResponse, HttpServer};
|
use actix_web::{middleware, web, App, HttpResponse, HttpServer};
|
||||||
|
|
||||||
fn index(id: Identity) -> String {
|
fn index(id: Identity) -> String {
|
||||||
|
@ -8,8 +8,9 @@ workspace = ".."
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
actix = "0.8.2"
|
actix = "0.8.2"
|
||||||
actix-rt = "0.2.2"
|
actix-rt = "0.2.2"
|
||||||
actix-web = "1.0.0"
|
actix-web = "1.0.2"
|
||||||
actix-files = "0.1.1"
|
actix-files = "0.1.1"
|
||||||
|
actix-identity= "0.1.0"
|
||||||
|
|
||||||
bcrypt = "0.2.1"
|
bcrypt = "0.2.1"
|
||||||
chrono = { version = "0.4.6", features = ["serde"] }
|
chrono = { version = "0.4.6", features = ["serde"] }
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use actix::{Handler, Message};
|
use actix::{Handler, Message};
|
||||||
use actix_web::{dev::Payload, Error, HttpRequest};
|
use actix_web::{dev::Payload, Error, HttpRequest, FromRequest};
|
||||||
use actix_web::{middleware::identity::Identity, FromRequest};
|
use actix_identity::Identity;
|
||||||
use bcrypt::verify;
|
use bcrypt::verify;
|
||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use actix::Addr;
|
use actix::Addr;
|
||||||
use actix_web::middleware::identity::Identity;
|
use actix_identity::Identity;
|
||||||
use actix_web::{web, Error, HttpRequest, HttpResponse, Responder, ResponseError};
|
use actix_web::{web, Error, HttpRequest, HttpResponse, Responder, ResponseError};
|
||||||
use futures::Future;
|
use futures::Future;
|
||||||
|
|
||||||
|
@ -7,10 +7,8 @@ extern crate serde_derive;
|
|||||||
|
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
use actix_files as fs;
|
use actix_files as fs;
|
||||||
use actix_web::middleware::{
|
use actix_identity::{CookieIdentityPolicy, IdentityService};
|
||||||
identity::{CookieIdentityPolicy, IdentityService},
|
use actix_web::middleware::Logger;
|
||||||
Logger,
|
|
||||||
};
|
|
||||||
use actix_web::{web, App, HttpServer};
|
use actix_web::{web, App, HttpServer};
|
||||||
use chrono::Duration;
|
use chrono::Duration;
|
||||||
use diesel::{r2d2::ConnectionManager, PgConnection};
|
use diesel::{r2d2::ConnectionManager, PgConnection};
|
||||||
|
@ -7,6 +7,7 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0"
|
actix-web = "1.0.0"
|
||||||
|
actix-cors = "0.1.0"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate serde_derive;
|
extern crate serde_derive;
|
||||||
|
|
||||||
use actix_web::{
|
use actix_cors::Cors;
|
||||||
http::header, middleware::cors::Cors, middleware::Logger, web, App, HttpServer,
|
use actix_web::{http::header, middleware::Logger, web, App, HttpServer};
|
||||||
};
|
|
||||||
|
|
||||||
mod user;
|
mod user;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user