diff --git a/.gitignore b/.gitignore index a024fdf..fbae9c1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules/ build/ .docusaurus .cache-loader -Cargo.lock \ No newline at end of file +Cargo.lock +yarn.lock diff --git a/examples/easy-form-handling/src/main.rs b/examples/easy-form-handling/src/main.rs index 08dc693..36730db 100644 --- a/examples/easy-form-handling/src/main.rs +++ b/examples/easy-form-handling/src/main.rs @@ -1,8 +1,8 @@ use actix_web::{web, App, HttpResponse, HttpServer, Responder}; use serde::Deserialize; -// use actix_web::web::{Either, Json, Form}; +// #[derive(Deserialize)] struct Register { username: String, diff --git a/examples/request-routing/src/main.rs b/examples/request-routing/src/main.rs index 3278e90..544421f 100644 --- a/examples/request-routing/src/main.rs +++ b/examples/request-routing/src/main.rs @@ -1,24 +1,21 @@ // -use actix_web::{get, web, App, HttpRequest, HttpServer, Responder}; +use actix_web::{get, web, App, HttpServer, Responder}; #[get("/")] -async fn index(_req: HttpRequest) -> impl Responder { - "Hello from the index page." +async fn index() -> impl Responder { + "Hello, World!" } -async fn hello(path: web::Path) -> impl Responder { - format!("Hello {}!", &path) +#[get("/{name}")] +async fn hello(name: web::Path) -> impl Responder { + format!("Hello {}!", &name) } #[actix_web::main] async fn main() -> std::io::Result<()> { - HttpServer::new(|| { - App::new() - .service(index) - .route("/{name}", web::get().to(hello)) - }) - .bind(("127.0.0.1", 8080))? - .run() - .await + HttpServer::new(|| App::new().service(index).service(hello)) + .bind(("127.0.0.1", 8080))? + .run() + .await } // diff --git a/src/css/custom.css b/src/css/custom.css index 2eace8e..55a3303 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -50,4 +50,4 @@ html[data-theme='dark'] { .navbar__logo { filter: var(--logo-filter); -} \ No newline at end of file +} diff --git a/src/pages/index.js b/src/pages/index.js index d0fb2be..71cf24a 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -22,7 +22,6 @@ const Home = () => {
-
@@ -97,21 +96,13 @@ const Hero = () => { ); }; -const MainExample = () => ( -
-
- -
-
-); - const Highlights = () => { return ( <>
-
+
{highlights.map((highlight, idx) => (
{ const Examples = () => { return ( -
+
-
-

Flexible Responders

-

- Handler functions in actix can return a wide range of objects that - implement the Responder trait. This makes it a breeze - to return consistent responses from your APIs. -

-
-
- +
+
+

Hello World!

+

+ Getting started with actix is easy. An actix app comes with a URL routing system that lets you match on + URLs and invoke individual handlers. +

+
+
+ +
-
-

Powerful Extractors

-

- Actix comes with a powerful extractor system that extracts data from - the incoming HTTP request and passes it to your view functions. Not - only does this make for a convenient API but it also means that your - view functions can be synchronous code and still benefit from - asynchronous IO handling. -

-
-
- +
+
+

Flexible Responders

+

+ Handler functions in actix can return a wide range of objects that + implement the Responder trait. This makes it a breeze + to return consistent responses from your APIs. +

+
+
+ +
-
-

Easy Form Handling

-

- Handling multipart/urlencoded form data is easy. Just define a - structure that can be deserialized and actix will handle the rest. -

-
-
- +
+
+

Powerful Extractors

+

+ Actix comes with a powerful extractor system that extracts data from + the incoming HTTP request and passes it to your view functions. Not + only does this make for a convenient API but it also means that your + view functions can be synchronous code and still benefit from + asynchronous IO handling. +

+
+
+ +
-
-

Request Routing

-

- An actix app comes with a URL routing system that lets you match on - URLs and invoke individual handlers. For extra flexibility, scopes - can be used. -

-
-
- +
+
+

Easy Form Handling

+

+ Handling multipart/urlencoded form data is easy. Just define a + structure that can be deserialized and actix will handle the rest. +

+
+
+ +
diff --git a/src/pages/styles.module.scss b/src/pages/styles.module.scss index f164788..0183472 100644 --- a/src/pages/styles.module.scss +++ b/src/pages/styles.module.scss @@ -110,28 +110,8 @@ color: var(--ifm-color-emphasis-600); } -.main_example { - display: flex; - justify-content: center; - padding-left: 1rem; - padding-right: 1rem; - flex-wrap: wrap; - padding-top: 2rem; - padding-bottom: 2rem; -} - -.main_example__code { - width: 100%; -} - -@media (min-width: 1024px) { - .main_example__code { - width: unset; - } -} - // features -.example { +.exampleContent { display: flex; width: 100%; flex-direction: column; @@ -145,30 +125,51 @@ } .example__code { + flex: 1; width: 100%; } .featureText { + flex: 1; justify-self: center; padding-bottom: 1rem; } @media (min-width: 1024px) { - .example { + .exampleContent { flex-direction: row; padding-top: 7rem; padding-bottom: 7rem; + max-width: 1280px; + margin: auto; } .example:nth-child(odd) { - flex-direction: row-reverse; background-color: var(--examples-odd-background-color); + + .exampleContent { + flex-direction: row-reverse; + + .featureText { + padding-right: 0px; + padding-left: 30px; + } + + .example__code { + padding-left: 0px; + padding-right: 30px; + } + } } + .featureText { width: 33%; + padding-right: 30px; } + .example__code { width: unset; + padding-left: 30px; } }