Skip to content

Commit

Permalink
chore: upgrade to ntex 1.0 (#3)
Browse files Browse the repository at this point in the history
* chore: upgrade to ntex 1.0
  • Loading branch information
leon3s committed Jan 12, 2024
1 parent 360c4ad commit 84c2676
Show file tree
Hide file tree
Showing 26 changed files with 33 additions and 45 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/[email protected]

- uses: actions-rust-lang/[email protected]
- name: test examples
run: |
cd examples
Expand Down
2 changes: 1 addition & 1 deletion examples/application/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ edition = "2018"
workspace = "../"

[dependencies]
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
2 changes: 1 addition & 1 deletion examples/async-handlers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ version = "2.0.0"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
futures = "0.3.1"
bytes = "0.5"
2 changes: 1 addition & 1 deletion examples/databases/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "1.0.0"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
diesel = { version = "2", features = ["sqlite", "r2d2"] }
serde = { version = "1", features = ["derive"] }
uuid = { version = "1", features = ["v4"] }
2 changes: 1 addition & 1 deletion examples/either/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "1.0.0"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
2 changes: 1 addition & 1 deletion examples/errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "1.0.0"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
derive_more = "0.99"
env_logger = "0.7"
log = "0.4"
2 changes: 1 addition & 1 deletion examples/extractors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ version = "1.0.0"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
serde = "1.0"
serde_json = "1.0"
2 changes: 1 addition & 1 deletion examples/flexible-responders/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ version = "1.0.0"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
serde = "1.0"
2 changes: 1 addition & 1 deletion examples/getting-started/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ edition = "2018"
workspace = "../"

[dependencies]
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
2 changes: 1 addition & 1 deletion examples/http2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ version = "1.0.0"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio", "openssl"] }
ntex = { version = "1.0.0", features = ["tokio", "openssl"] }
openssl = { version = "0.10", features = ["v110", "vendored"] }
2 changes: 1 addition & 1 deletion examples/main-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "1.0.0"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
4 changes: 2 additions & 2 deletions examples/middleware/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "1.0.0"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio", "cookie"] }
ntex-session = { version = "0.3.0" }
ntex = { version = "1.0.0", features = ["tokio", "cookie"] }
ntex-session = { version = "0.4.0" }
futures-util = { version = "0.3.7", default-features = false, features = ["std"] }
env_logger = "0.10.0"
6 changes: 1 addition & 5 deletions examples/middleware/src/errorhandler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// <error-handler>
use ntex::http::header;
use ntex::service::{Middleware, Service, ServiceCtx};
use ntex::util::BoxFuture;
use ntex::web;

pub struct Error;
Expand All @@ -27,12 +26,10 @@ where
{
type Response = web::WebResponse;
type Error = web::Error;
type Future<'f> = BoxFuture<'f, Result<Self::Response, Self::Error>> where Self: 'f;

ntex::forward_poll_ready!(service);

fn call<'a>(&'a self, req: web::WebRequest<Err>, ctx: ServiceCtx<'a, Self>) -> Self::Future<'_> {
Box::pin(async move {
async fn call(&self, req: web::WebRequest<Err>, ctx: ServiceCtx<'_, Self>) -> Result<Self::Response, Self::Error> {
ctx.call(&self.service, req).await.map(|mut res| {
let status = res.status();
if status.is_client_error() || status.is_server_error() {
Expand All @@ -43,7 +40,6 @@ where
}
res
})
})
}
}

Expand Down
15 changes: 4 additions & 11 deletions examples/middleware/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pub mod user_sessions;

// <simple>
use ntex::service::{Middleware, Service, ServiceCtx};
use ntex::util::BoxFuture;
use ntex::web;

// There are two steps in middleware processing.
Expand Down Expand Up @@ -33,20 +32,14 @@ where
{
type Response = web::WebResponse;
type Error = web::Error;
type Future<'f> = BoxFuture<'f, Result<Self::Response, Self::Error>> where Self: 'f;

ntex::forward_poll_ready!(service);

fn call<'a>(&'a self, req: web::WebRequest<Err>, ctx: ServiceCtx<'a, Self>) -> Self::Future<'_> {
async fn call(&self, req: web::WebRequest<Err>, ctx: ServiceCtx<'_, Self>) -> Result<Self::Response, Self::Error> {
println!("Hi from start. You requested: {}", req.path());

let fut = ctx.call(&self.service, req);
Box::pin(async move {
let res = fut.await?;

println!("Hi from response");
Ok(res)
})
let res = ctx.call(&self.service, req).await?;
println!("Hi from response");
Ok(res)
}
}
// </simple>
Expand Down
2 changes: 1 addition & 1 deletion examples/powerful-extractors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ version = "1.0.0"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
serde = "1.0"
2 changes: 1 addition & 1 deletion examples/request-handlers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "1.0.0"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
2 changes: 1 addition & 1 deletion examples/request-routing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "1.0.0"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
4 changes: 2 additions & 2 deletions examples/requests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ edition = "2018"
[dependencies]
serde = "1.0"
serde_json = "1.0"
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
futures = "0.3.1"
ntex-multipart = "0.3.0"
ntex-multipart = "0.4.0"
2 changes: 1 addition & 1 deletion examples/responses/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "1.0.0"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio", "compress"] }
ntex = { version = "1.0.0", features = ["tokio", "compress"] }
serde = "1.0"
futures = "0.3.1"
bytes = "0.5"
2 changes: 1 addition & 1 deletion examples/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ workspace = "../"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio", "openssl"] }
ntex = { version = "1.0.0", features = ["tokio", "openssl"] }
futures = "0.3"
openssl = { version = "0.10", features = ["vendored"] }
tokio = { version = "1.16.1", features = ["full"] }
4 changes: 2 additions & 2 deletions examples/static-files/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ version = "1.0.0"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio"] }
ntex-files = "0.3.0"
ntex = { version = "1.0.0", features = ["tokio"] }
ntex-files = "0.4.0"
mime = "0.3"
2 changes: 1 addition & 1 deletion examples/testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "1.0.0"
edition = "2018"

[dependencies]
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
futures = "0.3"
futures-util = "0.3"
bytes = "0.5"
Expand Down
2 changes: 1 addition & 1 deletion examples/url-dispatch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2018"
workspace = "../"

[dependencies]
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
futures = "0.3.1"
openssl = "0.10"
serde = "1.0"
2 changes: 1 addition & 1 deletion examples/websockets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ edition = "2018"

[dependencies]
futures = "0.3.27"
ntex = { version = "0.7", features = ["tokio"] }
ntex = { version = "1.0.0", features = ["tokio"] }
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ntex-website",
"version": "1.0.1",
"version": "1.1.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
Expand Down
4 changes: 2 additions & 2 deletions vars.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
rustVersion: '1.66',
ntexMajorVersion: '0.7',
rustVersion: '1.75',
ntexMajorVersion: '1.0',
};

0 comments on commit 84c2676

Please sign in to comment.