From 4a63711175a51565febd527882e6c6c7d680cf3e Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:19:42 +0800 Subject: [PATCH 01/69] Update README.md --- README.md | 81 +++++++++++++++++++++---------------------------------- 1 file changed, 30 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index cc1020bf..3851bfde 100644 --- a/README.md +++ b/README.md @@ -1,71 +1,50 @@ -# Actix Examples - -> Curated examples using the Actix ecosystem. - - - -[![build status](https://github.com/actix/examples/workflows/CI%20%28Linux%29/badge.svg?branch=master&event=push)](https://github.com/actix/examples/actions) -[![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x) - - - ## Community Showcase -- [Merino](https://github.com/mozilla-services/merino): Web service for Firefox Suggest. -- [Contile](https://github.com/mozilla-services/contile): The back-end server for the Mozilla Tile Service (MTS). -- [lemmy](https://github.com/dessalines/lemmy): A federated alternative to reddit in Rust. -- [MeiliSearch](https://github.com/meilisearch/MeiliSearch): Fast, Relevant and Typo-Tolerant Search Engine. Open source alternative to Algolia. -- [Martin](https://github.com/maplibre/martin): Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server. -- [hyperswitch](https://github.com/juspay/hyperswitch): An Open Source Financial Switch to make payment open, fast, secure and reliable. -- [tokei.rs](https://github.com/XAMPPRocky/tokei_rs): The tokei.rs server code. -- [Labrinth](https://github.com/modrinth/labrinth): Rust-based backend to serve the `modrinth` API. +- [Actix-Web Shuttle Template](https://github.com/sentinel1909/shuttle-templat-actix): A somewhat opinionated template for getting started with an Actix Web API and hosting it on Shuttle. +- [Atomic-Server](https://github.com/joepio/atomic-data-rust/): Graph database with a dynamic schema, authorization and full text search. - [Barricade](https://github.com/purton-tech/barricade): Quickly add user registration and logon to any application. +- [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. - [Bloom](https://github.com/skerkour/bloom): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more. -- [GitArena](https://github.com/mellowagain/gitarena): Software development platform with built-in VCS, issue tracking and code review. +- [Contile](https://github.com/mozilla-services/contile): The back-end server for the Mozilla Tile Service (MTS). +- [Dalted](https://github.com/carrascomj/dalted): Simple webapp that showcases the integration of [image-rs](https://github.com/image-rs/image) with Actix Web for color blindness simulations. - [Four in a Row - Server](https://github.com/ffactory-ofcl/fourinarow-server): An online version of the popular game four in a row, written in Rust on the server side and Flutter + Dart on the client. +- [gcs-proxy](https://github.com/guaychou/gcs-proxy): A Google Cloud Storage download proxy +- [GitArena](https://github.com/mellowagain/gitarena): Software development platform with built-in VCS, issue tracking and code review. +- [hyperswitch](https://github.com/juspay/hyperswitch): An Open Source Financial Switch to make payment open, fast, secure and reliable. +- [Labrinth](https://github.com/modrinth/labrinth): Rust-based backend to serve the `modrinth` API. +- [lemmy](https://github.com/dessalines/lemmy): A federated alternative to reddit in Rust. +- [Martin](https://github.com/maplibre/martin): Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server. +- **[mCaptcha](https://github.com/mCaptcha/mCaptcha/): Proof of work based, privacy focused, libre CAPTCHA system. Crates used: `actix-web`, `sqlx`, `redis`, and `lettre`.** +- [MeiliSearch](https://github.com/meilisearch/MeiliSearch): Fast, Relevant and Typo-Tolerant Search Engine. Open source alternative to Algolia. +- [Merino](https://github.com/mozilla-services/merino): Web service for Firefox Suggest. - [Nitro Repo](https://github.com/wherkamp/nitro_repo): An open source artifact manager. Rust back-end and Vue front-end. -- [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 book [zero2prod.com](https://www.zero2prod.com). Paid book but some of the chapters are 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. -- [Dalted](https://github.com/carrascomj/dalted): Simple webapp that showcases the integration of [image-rs](https://github.com/image-rs/image) with Actix Web for color blindness simulations. -- [Atomic-Server](https://github.com/joepio/atomic-data-rust/): Graph database with a dynamic schema, authorization and full text search. - [Operator](https://github.com/mkantor/operator): A web server for static and dynamic content. -- [RCOS Telescope](https://github.com/rcos/Telescope): The RCOS website and Discord bot. -- [WebThings Registration Server](https://github.com/WebThingsIO/registration_server): Exposes an HTTP API that lets you register a WebThings Gateway for tunneling support - [pict-rs](https://git.asonix.dog/asonix/pict-rs): An image host API service -- [rustypaste](https://github.com/orhun/rustypaste): A minimal file upload/pastebin service +- [RCOS Telescope](https://github.com/rcos/Telescope): The RCOS website and Discord bot. +- [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. - [rustus](https://github.com/s3rius/rustus): A TUS protocol implementation that helps you handle file uploads -- [gcs-proxy](https://github.com/guaychou/gcs-proxy): A Google Cloud Storage download proxy -- [Actix-Web Shuttle Template](https://github.com/sentinel1909/shuttle-templat-actix): A somewhat opinionated template for getting started with an Actix Web API and hosting it on Shuttle. +- [rustypaste](https://github.com/orhun/rustypaste): A minimal file upload/pastebin service +- [tokei.rs](https://github.com/XAMPPRocky/tokei_rs): The tokei.rs server code. - [trieve](https://github.com/devflowinc/trieve): All-in-one infrastructure for building search, recommendations, and RAG. +- [Triox](https://github.com/Trioxidation/Triox): A free file hosting server that focuses on speed, reliability and security. +- [WebThings Registration Server](https://github.com/WebThingsIO/registration_server): Exposes an HTTP API that lets you register a WebThings Gateway for tunneling support +- [Zero2prod](https://github.com/LukeMathWalker/zero-to-production/): Source code of zero to production book [zero2prod.com](https://www.zero2prod.com). Paid book but some of the chapters are available online for free. The book compares and explains the chosen technologies, like Actix Web and SQLx. ## Community Articles, Example Apps, Starters & Boilerplate Projects -- [create-rust-app](https://github.com/Wulf/create-rust-app): Set up a modern Rust + React web app by running one command. - [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. -- [RealWorld Example App](https://github.com/fairingrey/actix-realworld-example-app): Implementation of the RealWorld backend API spec in Actix. +- [Actix Server Authentication with JWT and MongoDB](https://github.com/emreyalvac/actix-web-jwt/): An implementation of JWT in Actix. +- [Blog with markdown rendering](https://github.com/gemini-15/blog-engine): Blog example built with Actix Web, diesel (with Postgres) and r2d2 rendering articles in markdown with metadata and a front-end with React. - [Canduma](https://github.com/clifinger/canduma): Rust authentication server boilerplate -- [Rust, Docker & GraphQL](https://github.com/jayy-lmao/rust-graphql-docker): An example of using Dataloaders, context, and a minimal docker container. - [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 +- [create-rust-app](https://github.com/Wulf/create-rust-app): Set up a modern Rust + React web app by running one command. - [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) +- [planters_cycle](https://github.com/grimm-integrations/planters_cycle): Another boilerplate fullstack application with identity system, prisma and NextJs. +- [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 - [rayspace.dev](https://github.com/ryspc/rayspace.dev): Minimalist dev portfolio and blog implemented as a Rust-powered SPA, featuring GitHub OAuth, session management, static file serving, API endpoints, and SQLx integration. -- [Blog with markdown rendering](https://github.com/gemini-15/blog-engine): Blog example built with Actix Web, diesel (with Postgres) and r2d2 rendering articles in markdown with metadata and a front-end with React. +- [RealWorld Example App](https://github.com/fairingrey/actix-realworld-example-app): Implementation of the RealWorld backend API spec in Actix. +- [Rust, Actix Web & Heroku](https://github.com/emk/rust-buildpack-example-actix): A Heroku buildpack example for Actix Web. - [Rust, Angular, PostgreSQL and JWT Security](https://github.com/stav121/actix-angular-project-template): Boilerplate project that implements an Angular + Actix Web application with login and registration pages, that is pre-dockerized. -- [planters_cycle](https://github.com/grimm-integrations/planters_cycle): Another boilerplate fullstack application with identity system, prisma and NextJs. - -## Paid Resources - -- [book] [Zero2prod by Luca Palmieri](https://algoluca.gumroad.com/l/zero2prod): Takes you on a journey to discover the world of backend development in Rust. - -## Contribute - -Pull requests welcome for small, focused example projects demonstrating patterns or techniques. - -Submissions also accepted to have your app or repo considered for the showcase lists. +- [Rust, Docker & GraphQL](https://github.com/jayy-lmao/rust-graphql-docker): An example of using Dataloaders, context, and a minimal docker container. +- [webapp.rs](https://github.com/saschagrunert/webapp.rs): A web application completely written in Rust. From 10340899e3e99ae70fb1870af475454ae5261baf Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:25:37 +0800 Subject: [PATCH 02/69] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 3851bfde..e85b97cd 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[actix_cors::Cors](cors/backend/src/main.rs) +[deadpool_postgres::Client](databases/postgres/src/db.rs) + ## Community Showcase - [Actix-Web Shuttle Template](https://github.com/sentinel1909/shuttle-templat-actix): A somewhat opinionated template for getting started with an Actix Web API and hosting it on Shuttle. From 8fea45cce2795142f1079302a53b0f43e8d0686c Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:28:49 +0800 Subject: [PATCH 03/69] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e85b97cd..f1e39634 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ -[actix_cors::Cors](cors/backend/src/main.rs) -[deadpool_postgres::Client](databases/postgres/src/db.rs) +## Usage +* [actix_cors::Cors::default()](cors/backend/src/main.rs) +* [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) +* [pg_mapper](cors/backend/src/main.rs) ## Community Showcase From 16f1f294fe6683056a7262424203cbea0f3be86e Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:30:43 +0800 Subject: [PATCH 04/69] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f1e39634..35eaaba8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[Monorepo](https://en.wikipedia.org/wiki/Monorepo) + ## Usage * [actix_cors::Cors::default()](cors/backend/src/main.rs) * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) From 0056cf453e970ca5405f79e4160d99356c2efe65 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:33:30 +0800 Subject: [PATCH 05/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 35eaaba8..897769dd 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ - [pict-rs](https://git.asonix.dog/asonix/pict-rs): An image host API service - [RCOS Telescope](https://github.com/rcos/Telescope): The RCOS website and Discord bot. - [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. -- [rustus](https://github.com/s3rius/rustus): A TUS protocol implementation that helps you handle file uploads +- [rustus](https://github.com/s3rius/rustus): A [TUS - the open protocol for resumable file uploads](https://github.com/tus/tusd) implementation that helps you handle file uploads - [rustypaste](https://github.com/orhun/rustypaste): A minimal file upload/pastebin service - [tokei.rs](https://github.com/XAMPPRocky/tokei_rs): The tokei.rs server code. - [trieve](https://github.com/devflowinc/trieve): All-in-one infrastructure for building search, recommendations, and RAG. From 0a03336cc533daaf766a641a6a6d9d7ed6af3fa5 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:35:45 +0800 Subject: [PATCH 06/69] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 897769dd..0f90e0e2 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,14 @@ - [Atomic-Server](https://github.com/joepio/atomic-data-rust/): Graph database with a dynamic schema, authorization and full text search. - [Barricade](https://github.com/purton-tech/barricade): Quickly add user registration and logon to any application. - [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. -- [Bloom](https://github.com/skerkour/bloom): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more. +**- [Bloom](https://github.com/skerkour/bloom-legacy): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more.** - [Contile](https://github.com/mozilla-services/contile): The back-end server for the Mozilla Tile Service (MTS). - [Dalted](https://github.com/carrascomj/dalted): Simple webapp that showcases the integration of [image-rs](https://github.com/image-rs/image) with Actix Web for color blindness simulations. - [Four in a Row - Server](https://github.com/ffactory-ofcl/fourinarow-server): An online version of the popular game four in a row, written in Rust on the server side and Flutter + Dart on the client. - [gcs-proxy](https://github.com/guaychou/gcs-proxy): A Google Cloud Storage download proxy - [GitArena](https://github.com/mellowagain/gitarena): Software development platform with built-in VCS, issue tracking and code review. - [hyperswitch](https://github.com/juspay/hyperswitch): An Open Source Financial Switch to make payment open, fast, secure and reliable. -- [Labrinth](https://github.com/modrinth/labrinth): Rust-based backend to serve the `modrinth` API. +**- [Labrinth](https://github.com/modrinth/labrinth): Rust-based backend to serve the `modrinth` API.** - [lemmy](https://github.com/dessalines/lemmy): A federated alternative to reddit in Rust. - [Martin](https://github.com/maplibre/martin): Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server. - **[mCaptcha](https://github.com/mCaptcha/mCaptcha/): Proof of work based, privacy focused, libre CAPTCHA system. Crates used: `actix-web`, `sqlx`, `redis`, and `lettre`.** From 9ea37cb94d1bc1e8d9d23c0f8cac26ea138a53d4 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:36:25 +0800 Subject: [PATCH 07/69] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0f90e0e2..f4183ff5 100644 --- a/README.md +++ b/README.md @@ -11,17 +11,17 @@ - [Atomic-Server](https://github.com/joepio/atomic-data-rust/): Graph database with a dynamic schema, authorization and full text search. - [Barricade](https://github.com/purton-tech/barricade): Quickly add user registration and logon to any application. - [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. -**- [Bloom](https://github.com/skerkour/bloom-legacy): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more.** +- ***[Bloom](https://github.com/skerkour/bloom-legacy): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more.*** - [Contile](https://github.com/mozilla-services/contile): The back-end server for the Mozilla Tile Service (MTS). - [Dalted](https://github.com/carrascomj/dalted): Simple webapp that showcases the integration of [image-rs](https://github.com/image-rs/image) with Actix Web for color blindness simulations. - [Four in a Row - Server](https://github.com/ffactory-ofcl/fourinarow-server): An online version of the popular game four in a row, written in Rust on the server side and Flutter + Dart on the client. - [gcs-proxy](https://github.com/guaychou/gcs-proxy): A Google Cloud Storage download proxy - [GitArena](https://github.com/mellowagain/gitarena): Software development platform with built-in VCS, issue tracking and code review. - [hyperswitch](https://github.com/juspay/hyperswitch): An Open Source Financial Switch to make payment open, fast, secure and reliable. -**- [Labrinth](https://github.com/modrinth/labrinth): Rust-based backend to serve the `modrinth` API.** +- ***[Labrinth](https://github.com/modrinth/labrinth): Rust-based backend to serve the `modrinth` API.*** - [lemmy](https://github.com/dessalines/lemmy): A federated alternative to reddit in Rust. - [Martin](https://github.com/maplibre/martin): Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server. -- **[mCaptcha](https://github.com/mCaptcha/mCaptcha/): Proof of work based, privacy focused, libre CAPTCHA system. Crates used: `actix-web`, `sqlx`, `redis`, and `lettre`.** +- ***[mCaptcha](https://github.com/mCaptcha/mCaptcha/): Proof of work based, privacy focused, libre CAPTCHA system. Crates used: `actix-web`, `sqlx`, `redis`, and `lettre`.*** - [MeiliSearch](https://github.com/meilisearch/MeiliSearch): Fast, Relevant and Typo-Tolerant Search Engine. Open source alternative to Algolia. - [Merino](https://github.com/mozilla-services/merino): Web service for Firefox Suggest. - [Nitro Repo](https://github.com/wherkamp/nitro_repo): An open source artifact manager. Rust back-end and Vue front-end. From 7c72f20ee9e283fe5aacbc3805a3ff22c36fba52 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:38:43 +0800 Subject: [PATCH 08/69] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f4183ff5..90a42d31 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -[Monorepo](https://en.wikipedia.org/wiki/Monorepo) +[Monorepo: Ease of code reuse](https://en.wikipedia.org/wiki/Monorepo) ## Usage * [actix_cors::Cors::default()](cors/backend/src/main.rs) -* [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) +* [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` * [pg_mapper](cors/backend/src/main.rs) ## Community Showcase From 9b7ddc61b24befab1ff8e3a19e3606875453d45f Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:40:45 +0800 Subject: [PATCH 09/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 90a42d31..448921f4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [Monorepo: Ease of code reuse](https://en.wikipedia.org/wiki/Monorepo) ## Usage -* [actix_cors::Cors::default()](cors/backend/src/main.rs) +* [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new( ... ) }` * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` * [pg_mapper](cors/backend/src/main.rs) From 20a5ec3e5d35423745d1cee3aa82b7be85358bee Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:43:24 +0800 Subject: [PATCH 10/69] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 448921f4..f0044767 100644 --- a/README.md +++ b/README.md @@ -24,15 +24,15 @@ - ***[mCaptcha](https://github.com/mCaptcha/mCaptcha/): Proof of work based, privacy focused, libre CAPTCHA system. Crates used: `actix-web`, `sqlx`, `redis`, and `lettre`.*** - [MeiliSearch](https://github.com/meilisearch/MeiliSearch): Fast, Relevant and Typo-Tolerant Search Engine. Open source alternative to Algolia. - [Merino](https://github.com/mozilla-services/merino): Web service for Firefox Suggest. -- [Nitro Repo](https://github.com/wherkamp/nitro_repo): An open source artifact manager. Rust back-end and Vue front-end. +- [Nitro Repo](https://github.com/wherkamp/nitro_repo): An open source artifact manager. ***Rust back-end and Vue front-end.*** - [Operator](https://github.com/mkantor/operator): A web server for static and dynamic content. - [pict-rs](https://git.asonix.dog/asonix/pict-rs): An image host API service - [RCOS Telescope](https://github.com/rcos/Telescope): The RCOS website and Discord bot. - [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. -- [rustus](https://github.com/s3rius/rustus): A [TUS - the open protocol for resumable file uploads](https://github.com/tus/tusd) implementation that helps you handle file uploads +- [rustus](https://github.com/s3rius/rustus): A ***[TUS - the open protocol for resumable file uploads](https://github.com/tus/tusd)*** implementation that helps you handle file uploads - [rustypaste](https://github.com/orhun/rustypaste): A minimal file upload/pastebin service - [tokei.rs](https://github.com/XAMPPRocky/tokei_rs): The tokei.rs server code. -- [trieve](https://github.com/devflowinc/trieve): All-in-one infrastructure for building search, recommendations, and RAG. +- [trieve](https://github.com/devflowinc/trieve): All-in-one infrastructure for building search, recommendations, and ***Retrieval Augmented Generation (RAG)***. - [Triox](https://github.com/Trioxidation/Triox): A free file hosting server that focuses on speed, reliability and security. - [WebThings Registration Server](https://github.com/WebThingsIO/registration_server): Exposes an HTTP API that lets you register a WebThings Gateway for tunneling support - [Zero2prod](https://github.com/LukeMathWalker/zero-to-production/): Source code of zero to production book [zero2prod.com](https://www.zero2prod.com). Paid book but some of the chapters are available online for free. The book compares and explains the chosen technologies, like Actix Web and SQLx. From bd6bf8edb6c05c04dbae7588d1badfd55cdde98b Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:44:09 +0800 Subject: [PATCH 11/69] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f0044767..ab85e6fc 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ * [pg_mapper](cors/backend/src/main.rs) ## Community Showcase +Many of these repos use SQLX for Postgres. - [Actix-Web Shuttle Template](https://github.com/sentinel1909/shuttle-templat-actix): A somewhat opinionated template for getting started with an Actix Web API and hosting it on Shuttle. - [Atomic-Server](https://github.com/joepio/atomic-data-rust/): Graph database with a dynamic schema, authorization and full text search. From 011517f5b6942f75f1587fb760d80eb3948e1c42 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:47:04 +0800 Subject: [PATCH 12/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ab85e6fc..4af0b7c6 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Many of these repos use SQLX for Postgres. - [Nitro Repo](https://github.com/wherkamp/nitro_repo): An open source artifact manager. ***Rust back-end and Vue front-end.*** - [Operator](https://github.com/mkantor/operator): A web server for static and dynamic content. - [pict-rs](https://git.asonix.dog/asonix/pict-rs): An image host API service -- [RCOS Telescope](https://github.com/rcos/Telescope): The RCOS website and Discord bot. +- [RCOS Telescope](https://github.com/rcos/Telescope): The RCOS (Ren,sse`lae,r /rɛnsəˈlɪər/ Polytechnic Institute) website and Discord bot. - [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. - [rustus](https://github.com/s3rius/rustus): A ***[TUS - the open protocol for resumable file uploads](https://github.com/tus/tusd)*** implementation that helps you handle file uploads - [rustypaste](https://github.com/orhun/rustypaste): A minimal file upload/pastebin service From 8dfb027a71a49801e57be05bcf96bc5766b55638 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:49:48 +0800 Subject: [PATCH 13/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4af0b7c6..b7437cac 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ * [pg_mapper](cors/backend/src/main.rs) ## Community Showcase -Many of these repos use SQLX for Postgres. +Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres, e.g., `sqlx::postgres::PgPoolOptions`. - [Actix-Web Shuttle Template](https://github.com/sentinel1909/shuttle-templat-actix): A somewhat opinionated template for getting started with an Actix Web API and hosting it on Shuttle. - [Atomic-Server](https://github.com/joepio/atomic-data-rust/): Graph database with a dynamic schema, authorization and full text search. From bc914f47d81a47f9165279e7229a8159a5ce42ad Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:52:40 +0800 Subject: [PATCH 14/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b7437cac..c75eb940 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres - ***[mCaptcha](https://github.com/mCaptcha/mCaptcha/): Proof of work based, privacy focused, libre CAPTCHA system. Crates used: `actix-web`, `sqlx`, `redis`, and `lettre`.*** - [MeiliSearch](https://github.com/meilisearch/MeiliSearch): Fast, Relevant and Typo-Tolerant Search Engine. Open source alternative to Algolia. - [Merino](https://github.com/mozilla-services/merino): Web service for Firefox Suggest. -- [Nitro Repo](https://github.com/wherkamp/nitro_repo): An open source artifact manager. ***Rust back-end and Vue front-end.*** +- [Nitro Repo](https://github.com/wherkamp/nitro_repo): An open source artifact (build output) manager. ***Rust back-end and Vue front-end.*** - [Operator](https://github.com/mkantor/operator): A web server for static and dynamic content. - [pict-rs](https://git.asonix.dog/asonix/pict-rs): An image host API service - [RCOS Telescope](https://github.com/rcos/Telescope): The RCOS (Ren,sse`lae,r /rɛnsəˈlɪər/ Polytechnic Institute) website and Discord bot. From bd50dc2a341d1c4594662b0d854e6ee8e293d0e6 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:54:40 +0800 Subject: [PATCH 15/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c75eb940..4e5234e7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [Monorepo: Ease of code reuse](https://en.wikipedia.org/wiki/Monorepo) ## Usage -* [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new( ... ) }` +* [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new( ... ) }` ***CORS is also a Vite/Vue example !!!*** * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` * [pg_mapper](cors/backend/src/main.rs) From 872c9745102b64adf44eb4dcef9bccad3a4347b1 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:55:33 +0800 Subject: [PATCH 16/69] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4e5234e7..ad70e843 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ [Monorepo: Ease of code reuse](https://en.wikipedia.org/wiki/Monorepo) +***actix + Vue is a popular and perfect combo*** + ## Usage * [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new( ... ) }` ***CORS is also a Vite/Vue example !!!*** * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` From 51c637c4b1ebdedc66660ec63e221cdcb3c9c00e Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:56:21 +0800 Subject: [PATCH 17/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ad70e843..cabfaf81 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ***actix + Vue is a popular and perfect combo*** ## Usage -* [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new( ... ) }` ***CORS is also a Vite/Vue example !!!*** +* [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new().wrap( ... ) }` ***CORS is also a Vite/Vue example !!!*** * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` * [pg_mapper](cors/backend/src/main.rs) From 743ab64a690d7cc35361d973d13d22aba8f45e24 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 09:58:13 +0800 Subject: [PATCH 18/69] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cabfaf81..2cc6288f 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ ## Usage * [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new().wrap( ... ) }` ***CORS is also a Vite/Vue example !!!*** * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` +* `client.query(&stmt, &[&user_info.email, &user_info.first_name, &user_info.last_name, &user_info.username,],)` * [pg_mapper](cors/backend/src/main.rs) ## Community Showcase From d1eaf4a25db74b2aa4212e401366732fd4068c1a Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:02:30 +0800 Subject: [PATCH 19/69] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2cc6288f..fa4866a1 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres - [Barricade](https://github.com/purton-tech/barricade): Quickly add user registration and logon to any application. - [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. - ***[Bloom](https://github.com/skerkour/bloom-legacy): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more.*** + - [It uses Vue 2](https://github.com/skerkour/bloom-legacy/blob/fa91a0fcfb779a5657cbbbfaf9ea305e79570122/webapp/package.json) - [Contile](https://github.com/mozilla-services/contile): The back-end server for the Mozilla Tile Service (MTS). - [Dalted](https://github.com/carrascomj/dalted): Simple webapp that showcases the integration of [image-rs](https://github.com/image-rs/image) with Actix Web for color blindness simulations. - [Four in a Row - Server](https://github.com/ffactory-ofcl/fourinarow-server): An online version of the popular game four in a row, written in Rust on the server side and Flutter + Dart on the client. From eb49d043c5c1b37f20857c8d7b11a07971cdb1a5 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:02:58 +0800 Subject: [PATCH 20/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fa4866a1..dded7336 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres - [Barricade](https://github.com/purton-tech/barricade): Quickly add user registration and logon to any application. - [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. - ***[Bloom](https://github.com/skerkour/bloom-legacy): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more.*** - - [It uses Vue 2](https://github.com/skerkour/bloom-legacy/blob/fa91a0fcfb779a5657cbbbfaf9ea305e79570122/webapp/package.json) + - [It uses Vuetify 2](https://github.com/skerkour/bloom-legacy/blob/fa91a0fcfb779a5657cbbbfaf9ea305e79570122/webapp/package.json) - [Contile](https://github.com/mozilla-services/contile): The back-end server for the Mozilla Tile Service (MTS). - [Dalted](https://github.com/carrascomj/dalted): Simple webapp that showcases the integration of [image-rs](https://github.com/image-rs/image) with Actix Web for color blindness simulations. - [Four in a Row - Server](https://github.com/ffactory-ofcl/fourinarow-server): An online version of the popular game four in a row, written in Rust on the server side and Flutter + Dart on the client. From 45f7fc4769629e87ac61640d55dd765104c77b7c Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:05:45 +0800 Subject: [PATCH 21/69] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index dded7336..566cbd86 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +Forked this repo to learn actix-web. + [Monorepo: Ease of code reuse](https://en.wikipedia.org/wiki/Monorepo) ***actix + Vue is a popular and perfect combo*** From f8a58d2cade6403d12262f93c124f15434c70238 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:10:29 +0800 Subject: [PATCH 22/69] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 566cbd86..5b3d740b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +New = good. Your mom resorts to old ways - stability (...), Austria (which is old), Chinese geomancy (which is old), and the Pope (...) simutaneously. + Forked this repo to learn actix-web. [Monorepo: Ease of code reuse](https://en.wikipedia.org/wiki/Monorepo) From adf9ef5571d904cdb2543f1d81f1c6d3581497d6 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:11:49 +0800 Subject: [PATCH 23/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b3d740b..0e0fbe5a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -New = good. Your mom resorts to old ways - stability (...), Austria (which is old), Chinese geomancy (which is old), and the Pope (...) simutaneously. +New!!! Your mom resorts to old ways - stability (...), Austria (which is old), Chinese geomancy (which is old), and the Pope (...) simutaneously. Forked this repo to learn actix-web. From 27aaf063291773f1991ac84e4f816d1b4ef7e14f Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:14:49 +0800 Subject: [PATCH 24/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e0fbe5a..cf0a8191 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Forked this repo to learn actix-web. ***actix + Vue is a popular and perfect combo*** ## Usage -* [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new().wrap( ... ) }` ***CORS is also a Vite/Vue example !!!*** +* [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new().wrap( ... ) }` ***CORS is also a Vite/Vue example !!! This is also a 'log in' sample.*** * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` * `client.query(&stmt, &[&user_info.email, &user_info.first_name, &user_info.last_name, &user_info.username,],)` * [pg_mapper](cors/backend/src/main.rs) From 02641edebf7d50757fc6e6e71c46bc6d0cea462e Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:16:30 +0800 Subject: [PATCH 25/69] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cf0a8191..b6aac342 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,8 @@ Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres - [Actix-Web Shuttle Template](https://github.com/sentinel1909/shuttle-templat-actix): A somewhat opinionated template for getting started with an Actix Web API and hosting it on Shuttle. - [Atomic-Server](https://github.com/joepio/atomic-data-rust/): Graph database with a dynamic schema, authorization and full text search. -- [Barricade](https://github.com/purton-tech/barricade): Quickly add user registration and logon to any application. +- ***[Barricade](https://github.com/purton-tech/barricade): Quickly add user registration and logon to any application.*** + - Interesting. Comes with hCaptcha too. - [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. - ***[Bloom](https://github.com/skerkour/bloom-legacy): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more.*** - [It uses Vuetify 2](https://github.com/skerkour/bloom-legacy/blob/fa91a0fcfb779a5657cbbbfaf9ea305e79570122/webapp/package.json) From 47154e3aedef1d9e566494e12ccbe88f3b3f7dc3 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:18:30 +0800 Subject: [PATCH 26/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b6aac342..29952a60 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres - [Actix-Web Shuttle Template](https://github.com/sentinel1909/shuttle-templat-actix): A somewhat opinionated template for getting started with an Actix Web API and hosting it on Shuttle. - [Atomic-Server](https://github.com/joepio/atomic-data-rust/): Graph database with a dynamic schema, authorization and full text search. - ***[Barricade](https://github.com/purton-tech/barricade): Quickly add user registration and logon to any application.*** - - Interesting. Comes with hCaptcha too. + - Interesting. Comes with hCaptcha too. 'Works well as a Kubernetes side car.' - [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. - ***[Bloom](https://github.com/skerkour/bloom-legacy): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more.*** - [It uses Vuetify 2](https://github.com/skerkour/bloom-legacy/blob/fa91a0fcfb779a5657cbbbfaf9ea305e79570122/webapp/package.json) From ae0f3133b455f86bc601d00f4a5782f492ceb3b1 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:20:13 +0800 Subject: [PATCH 27/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 29952a60..60bfa786 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres - Interesting. Comes with hCaptcha too. 'Works well as a Kubernetes side car.' - [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. - ***[Bloom](https://github.com/skerkour/bloom-legacy): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more.*** - - [It uses Vuetify 2](https://github.com/skerkour/bloom-legacy/blob/fa91a0fcfb779a5657cbbbfaf9ea305e79570122/webapp/package.json) + - [It uses Vuetify 2 + Axios](https://github.com/skerkour/bloom-legacy/blob/fa91a0fcfb779a5657cbbbfaf9ea305e79570122/webapp/package.json) - [Contile](https://github.com/mozilla-services/contile): The back-end server for the Mozilla Tile Service (MTS). - [Dalted](https://github.com/carrascomj/dalted): Simple webapp that showcases the integration of [image-rs](https://github.com/image-rs/image) with Actix Web for color blindness simulations. - [Four in a Row - Server](https://github.com/ffactory-ofcl/fourinarow-server): An online version of the popular game four in a row, written in Rust on the server side and Flutter + Dart on the client. From 75802fa2af48bd5d681b371982e33bcbbdf3d8c5 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:20:37 +0800 Subject: [PATCH 28/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 60bfa786..9fabdff7 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres - Interesting. Comes with hCaptcha too. 'Works well as a Kubernetes side car.' - [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. - ***[Bloom](https://github.com/skerkour/bloom-legacy): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more.*** - - [It uses Vuetify 2 + Axios](https://github.com/skerkour/bloom-legacy/blob/fa91a0fcfb779a5657cbbbfaf9ea305e79570122/webapp/package.json) + - [It uses Vuetify 2 (EOL) + Axios](https://github.com/skerkour/bloom-legacy/blob/fa91a0fcfb779a5657cbbbfaf9ea305e79570122/webapp/package.json) - [Contile](https://github.com/mozilla-services/contile): The back-end server for the Mozilla Tile Service (MTS). - [Dalted](https://github.com/carrascomj/dalted): Simple webapp that showcases the integration of [image-rs](https://github.com/image-rs/image) with Actix Web for color blindness simulations. - [Four in a Row - Server](https://github.com/ffactory-ofcl/fourinarow-server): An online version of the popular game four in a row, written in Rust on the server side and Flutter + Dart on the client. From bc4ca6a98224ff6e4b9dc3ee7523ae525d24d9a0 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:23:10 +0800 Subject: [PATCH 29/69] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9fabdff7..7643d8a6 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,11 @@ Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres - ***[mCaptcha](https://github.com/mCaptcha/mCaptcha/): Proof of work based, privacy focused, libre CAPTCHA system. Crates used: `actix-web`, `sqlx`, `redis`, and `lettre`.*** - [MeiliSearch](https://github.com/meilisearch/MeiliSearch): Fast, Relevant and Typo-Tolerant Search Engine. Open source alternative to Algolia. - [Merino](https://github.com/mozilla-services/merino): Web service for Firefox Suggest. -- [Nitro Repo](https://github.com/wherkamp/nitro_repo): An open source artifact (build output) manager. ***Rust back-end and Vue front-end.*** +- [Nitro Repo](https://github.com/wherkamp/nitro_repo): An open source ***artifact (build output)*** manager. ***Rust back-end and Vue front-end.*** - [Operator](https://github.com/mkantor/operator): A web server for static and dynamic content. - [pict-rs](https://git.asonix.dog/asonix/pict-rs): An image host API service - [RCOS Telescope](https://github.com/rcos/Telescope): The RCOS (Ren,sse`lae,r /rɛnsəˈlɪər/ Polytechnic Institute) website and Discord bot. -- [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 (Internet relay chat)*** bot to access simple SQLite database. Demonstrates usage of various Actix and Actix Web concepts. - [rustus](https://github.com/s3rius/rustus): A ***[TUS - the open protocol for resumable file uploads](https://github.com/tus/tusd)*** implementation that helps you handle file uploads - [rustypaste](https://github.com/orhun/rustypaste): A minimal file upload/pastebin service - [tokei.rs](https://github.com/XAMPPRocky/tokei_rs): The tokei.rs server code. From 995a4acb884e1d0103655e2e380f747a7a449922 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:26:19 +0800 Subject: [PATCH 30/69] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7643d8a6..9fb7089e 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres - [Four in a Row - Server](https://github.com/ffactory-ofcl/fourinarow-server): An online version of the popular game four in a row, written in Rust on the server side and Flutter + Dart on the client. - [gcs-proxy](https://github.com/guaychou/gcs-proxy): A Google Cloud Storage download proxy - [GitArena](https://github.com/mellowagain/gitarena): Software development platform with built-in VCS, issue tracking and code review. + - vs. GitLab self-hosted, and Gitea (written in Go, 45k stars) - [hyperswitch](https://github.com/juspay/hyperswitch): An Open Source Financial Switch to make payment open, fast, secure and reliable. - ***[Labrinth](https://github.com/modrinth/labrinth): Rust-based backend to serve the `modrinth` API.*** - [lemmy](https://github.com/dessalines/lemmy): A federated alternative to reddit in Rust. From 8c7cdbb92e2152d953113e1b8fc8c073fede78ea Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:37:19 +0800 Subject: [PATCH 31/69] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 9fb7089e..548c353b 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ Forked this repo to learn actix-web. ***actix + Vue is a popular and perfect combo*** +[thirtyfour](https://github.com/Vrtgs/thirtyfour) + +[Ungoliant: rayon + reqwest](https://github.com/oscar-project/ungoliant/blob/main/Cargo.toml) + ## Usage * [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new().wrap( ... ) }` ***CORS is also a Vite/Vue example !!! This is also a 'log in' sample.*** * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` From e15c3027a17df41e33d6f1f8352b89c6d395ce5c Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:38:38 +0800 Subject: [PATCH 32/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 548c353b..7f405fd5 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Forked this repo to learn actix-web. ***actix + Vue is a popular and perfect combo*** -[thirtyfour](https://github.com/Vrtgs/thirtyfour) +[thirtyfour](https://github.com/Vrtgs/thirtyfour) `goto()`, `find()`, supports `send_keys()` [Ungoliant: rayon + reqwest](https://github.com/oscar-project/ungoliant/blob/main/Cargo.toml) From b80a2f33b9f0a1435416be4cd96a3b9635e72d4b Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:41:43 +0800 Subject: [PATCH 33/69] Update README.md --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f405fd5..00cc4e5d 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,21 @@ Forked this repo to learn actix-web. * [pg_mapper](cors/backend/src/main.rs) ## Community Showcase -Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres, e.g., `sqlx::postgres::PgPoolOptions`. +Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres, e.g., `sqlx::postgres::PgPoolOptions`: +```rust +let pool = PgPoolOptions::new() + .max_connections(5) + .connect("postgres://postgres:password@localhost/test").await?; +// Make a simple query to return the given parameter (use a question mark `?` instead of `$1` for MySQL/MariaDB) +let row: (i64,) = sqlx::query_as("SELECT $1") + .bind(150_i64) + .fetch_one(&pool).await?; + +assert_eq!(row.0, 150); + +Ok(()) +``` - [Actix-Web Shuttle Template](https://github.com/sentinel1909/shuttle-templat-actix): A somewhat opinionated template for getting started with an Actix Web API and hosting it on Shuttle. - [Atomic-Server](https://github.com/joepio/atomic-data-rust/): Graph database with a dynamic schema, authorization and full text search. - ***[Barricade](https://github.com/purton-tech/barricade): Quickly add user registration and logon to any application.*** From 0b434d1aef0bf88c110139593fa329e069fc8a36 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:55:19 +0800 Subject: [PATCH 34/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 00cc4e5d..f820bf3f 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres ```rust let pool = PgPoolOptions::new() .max_connections(5) - .connect("postgres://postgres:password@localhost/test").await?; + .connect("postgres://postgres:password@localhost/test").await?; // Get this from ENV // Make a simple query to return the given parameter (use a question mark `?` instead of `$1` for MySQL/MariaDB) let row: (i64,) = sqlx::query_as("SELECT $1") From cd38ba57bb54a6da4c1fa4ff9b1a26e6acdf1dd0 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 10:57:31 +0800 Subject: [PATCH 35/69] Update README.md --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index f820bf3f..ecd7900d 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,38 @@ Forked this repo to learn actix-web. ***actix + Vue is a popular and perfect combo*** [thirtyfour](https://github.com/Vrtgs/thirtyfour) `goto()`, `find()`, supports `send_keys()` +```rust +use thirtyfour::prelude::*; + +#[tokio::main] +async fn main() -> WebDriverResult<()> { + let caps = DesiredCapabilities::chrome(); + let driver = WebDriver::new("http://localhost:9515", caps).await?; + + // Navigate to https://wikipedia.org. + driver.goto("https://wikipedia.org").await?; + let elem_form = driver.find(By::Id("search-form")).await?; + + // Find element from element. + let elem_text = elem_form.find(By::Id("searchInput")).await?; + + // Type in the search terms. + elem_text.send_keys("selenium").await?; + + // Click the search button. + let elem_button = elem_form.find(By::Css("button[type='submit']")).await?; + elem_button.click().await?; + + // Look for header to implicitly wait for the page to load. + driver.find(By::ClassName("firstHeading")).await?; + assert_eq!(driver.title().await?, "Selenium - Wikipedia"); + + // Always explicitly close the browser. + driver.quit().await?; + + Ok(()) +} +``` [Ungoliant: rayon + reqwest](https://github.com/oscar-project/ungoliant/blob/main/Cargo.toml) From 4bb304bfda4ff1b26cdaecb272c5b6c653930c03 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 11:00:42 +0800 Subject: [PATCH 36/69] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ecd7900d..539618a9 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,11 @@ Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres ```rust let pool = PgPoolOptions::new() .max_connections(5) - .connect("postgres://postgres:password@localhost/test").await?; // Get this from ENV + .connect("postgres://postgres:password@localhost/test").await?; // Alex: Get this from ENV // Make a simple query to return the given parameter (use a question mark `?` instead of `$1` for MySQL/MariaDB) let row: (i64,) = sqlx::query_as("SELECT $1") - .bind(150_i64) + .bind(150_i64) // Alex: This is even nicer than SQLAlchemy in Python .fetch_one(&pool).await?; assert_eq!(row.0, 150); From 0f82c6b8115e646c4aafc4fd6dd2bfb8d40a91b5 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 11:05:21 +0800 Subject: [PATCH 37/69] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 539618a9..a89612ee 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,8 @@ async fn main() -> WebDriverResult<()> { [Ungoliant: rayon + reqwest](https://github.com/oscar-project/ungoliant/blob/main/Cargo.toml) +## BYOT: Build Your Own Tools + ## Usage * [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new().wrap( ... ) }` ***CORS is also a Vite/Vue example !!! This is also a 'log in' sample.*** * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` From a4bb69da6196eac9d8c10af8a9661073d025486c Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 13:56:43 +0800 Subject: [PATCH 38/69] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a89612ee..433fb9a3 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,10 @@ Forked this repo to learn actix-web. ***actix + Vue is a popular and perfect combo*** -[thirtyfour](https://github.com/Vrtgs/thirtyfour) `goto()`, `find()`, supports `send_keys()` +---- +Refactor feedback management system + +using `actix` + [thirtyfour](https://github.com/Vrtgs/thirtyfour) (`goto()`, `find()`, supports `send_keys()`) as backend ```rust use thirtyfour::prelude::*; From 97f0a874b7984d038c59e9363d2a968c269b0cac Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 13:58:00 +0800 Subject: [PATCH 39/69] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 433fb9a3..422ff0d6 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,10 @@ Refactor feedback management system using `actix` + [thirtyfour](https://github.com/Vrtgs/thirtyfour) (`goto()`, `find()`, supports `send_keys()`) as backend ```rust +// 1. GoMa +// 2. TrAd +// 3. TrPi + use thirtyfour::prelude::*; #[tokio::main] From 6077d7eacf10f2b4a396965956a4cc6c4176c5ac Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 14:02:42 +0800 Subject: [PATCH 40/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 422ff0d6..1ac89ec8 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ async fn main() -> WebDriverResult<()> { ## BYOT: Build Your Own Tools ## Usage -* [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new().wrap( ... ) }` ***CORS is also a Vite/Vue example !!! This is also a 'log in' sample.*** +* [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new().wrap( ... ) }` ***CORS is also a [Vue ^3.3.4](https://github.com/AlexanderPoone/actix/blob/master/cors/frontend/package.json) sample !!! This is also a 'log in' sample.*** * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` * `client.query(&stmt, &[&user_info.email, &user_info.first_name, &user_info.last_name, &user_info.username,],)` * [pg_mapper](cors/backend/src/main.rs) From b1fd82ce722d18e4c16346cb66954c04983db492 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 14:06:31 +0800 Subject: [PATCH 41/69] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1ac89ec8..bd894bf9 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ async fn main() -> WebDriverResult<()> { // Type in the search terms. elem_text.send_keys("selenium").await?; + elem_text.send_keys(Key::Control + "a").await?; + elem_text.send_keys("thirtyfour" + Key::Enter).await?; // Click the search button. let elem_button = elem_form.find(By::Css("button[type='submit']")).await?; From 403b7ef018c508651247a595ec91f1902d8ffda0 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 14:07:43 +0800 Subject: [PATCH 42/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bd894bf9..6c7bb101 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ async fn main() -> WebDriverResult<()> { } ``` -[Ungoliant: rayon + reqwest](https://github.com/oscar-project/ungoliant/blob/main/Cargo.toml) +cf. [Ungoliant: rayon + reqwest](https://github.com/oscar-project/ungoliant/blob/main/Cargo.toml) (actix + thirtyfour + rayon) ## BYOT: Build Your Own Tools From 8b50b4d0c0d4a22abe38c8661b0506d2e6b50a9b Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 14:22:51 +0800 Subject: [PATCH 43/69] Update README.md --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 6c7bb101..ef77e5cb 100644 --- a/README.md +++ b/README.md @@ -18,23 +18,19 @@ using `actix` + [thirtyfour](https://github.com/Vrtgs/thirtyfour) (`goto()`, `fi use thirtyfour::prelude::*; #[tokio::main] -async fn main() -> WebDriverResult<()> { +async fn main() -> WebDriverResult<()> { <------ called by Actix, should stream progress ! let caps = DesiredCapabilities::chrome(); let driver = WebDriver::new("http://localhost:9515", caps).await?; - // Navigate to https://wikipedia.org. driver.goto("https://wikipedia.org").await?; let elem_form = driver.find(By::Id("search-form")).await?; - // Find element from element. let elem_text = elem_form.find(By::Id("searchInput")).await?; - // Type in the search terms. elem_text.send_keys("selenium").await?; elem_text.send_keys(Key::Control + "a").await?; elem_text.send_keys("thirtyfour" + Key::Enter).await?; - // Click the search button. let elem_button = elem_form.find(By::Css("button[type='submit']")).await?; elem_button.click().await?; From afcca641662acdcf1bfad37300f940efef007bbd Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 14:23:03 +0800 Subject: [PATCH 44/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ef77e5cb..179a7721 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ using `actix` + [thirtyfour](https://github.com/Vrtgs/thirtyfour) (`goto()`, `fi use thirtyfour::prelude::*; #[tokio::main] -async fn main() -> WebDriverResult<()> { <------ called by Actix, should stream progress ! +async fn main() -> WebDriverResult<()> { // <------ called by Actix, should stream progress ! let caps = DesiredCapabilities::chrome(); let driver = WebDriver::new("http://localhost:9515", caps).await?; From 58e10f38a021f26f9eddf23e2ae04e1536ced249 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 14:24:18 +0800 Subject: [PATCH 45/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 179a7721..2846775b 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Refactor feedback management system using `actix` + [thirtyfour](https://github.com/Vrtgs/thirtyfour) (`goto()`, `find()`, supports `send_keys()`) as backend ```rust // 1. GoMa -// 2. TrAd +// 2. TrAd (bit trickier. searchbox can't be triggered) // 3. TrPi use thirtyfour::prelude::*; From c132243a5d193022f0c39c30d54575ebb43b61c2 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 15:23:36 +0800 Subject: [PATCH 46/69] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 2846775b..9ee5d0bd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -New!!! Your mom resorts to old ways - stability (...), Austria (which is old), Chinese geomancy (which is old), and the Pope (...) simutaneously. - + Forked this repo to learn actix-web. [Monorepo: Ease of code reuse](https://en.wikipedia.org/wiki/Monorepo) From 9759f8565706601f8e18f63ab0e63e9390e00f3a Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 15:30:11 +0800 Subject: [PATCH 47/69] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 9ee5d0bd..70ad92e8 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,12 @@ using `actix` + [thirtyfour](https://github.com/Vrtgs/thirtyfour) (`goto()`, `fi // 1. GoMa // 2. TrAd (bit trickier. searchbox can't be triggered) // 3. TrPi +//////////////////////// +// Siame Netwo Simil (Keywo Searc) +// Siame Netwo Simil (Dupli Remov, mostl hate comme) +// Gende +// Natio +// Spam Remov use thirtyfour::prelude::*; From e2ed53823625f5a264921510207a37aec2785421 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 15:31:28 +0800 Subject: [PATCH 48/69] Update README.md --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 70ad92e8..de2e0160 100644 --- a/README.md +++ b/README.md @@ -10,15 +10,19 @@ Refactor feedback management system using `actix` + [thirtyfour](https://github.com/Vrtgs/thirtyfour) (`goto()`, `find()`, supports `send_keys()`) as backend ```rust +//////////////////////// +// Sources: // 1. GoMa // 2. TrAd (bit trickier. searchbox can't be triggered) // 3. TrPi //////////////////////// -// Siame Netwo Simil (Keywo Searc) -// Siame Netwo Simil (Dupli Remov, mostl hate comme) -// Gende -// Natio -// Spam Remov +// Basic features: +// a. Siame Netwo Simil (Keywo Searc) +// b. Siame Netwo Simil (Dupli Remov, mostl hate comme) +// c. Gende +// d. Natio +// e. Spam Remov +//////////////////////// use thirtyfour::prelude::*; From bfe3478e18991e7ee7864b7fdfab3b805818ba59 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 15:34:27 +0800 Subject: [PATCH 49/69] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index de2e0160..7db5986e 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ using `actix` + [thirtyfour](https://github.com/Vrtgs/thirtyfour) (`goto()`, `fi //////////////////////// use thirtyfour::prelude::*; +use std::{thread, time::Duration}; #[tokio::main] async fn main() -> WebDriverResult<()> { // <------ called by Actix, should stream progress ! @@ -37,7 +38,9 @@ async fn main() -> WebDriverResult<()> { // <------ cal let elem_text = elem_form.find(By::Id("searchInput")).await?; elem_text.send_keys("selenium").await?; + thread::sleep(Duration::from_millis(1500)); elem_text.send_keys(Key::Control + "a").await?; + thread::sleep(Duration::from_millis(500)); elem_text.send_keys("thirtyfour" + Key::Enter).await?; let elem_button = elem_form.find(By::Css("button[type='submit']")).await?; From 07afea28fb4c34be5de061ce958285d6fc9b2d43 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 15:36:41 +0800 Subject: [PATCH 50/69] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7db5986e..7ec9b563 100644 --- a/README.md +++ b/README.md @@ -68,8 +68,10 @@ cf. [Ungoliant: rayon + reqwest](https://github.com/oscar-project/ungoliant/blob * [pg_mapper](cors/backend/src/main.rs) ## Community Showcase -Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres, e.g., `sqlx::postgres::PgPoolOptions`: +Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres, e.g., `sqlx::postgres::PgPoolOptions` (Pg for Postgrs): ```rust +use sqlx::postgres::PgPoolOptions; + let pool = PgPoolOptions::new() .max_connections(5) .connect("postgres://postgres:password@localhost/test").await?; // Alex: Get this from ENV From aec6d9f9b2ec1a16922f059d398dc633fb8817f5 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 15:37:03 +0800 Subject: [PATCH 51/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ec9b563..4f60c1bb 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ cf. [Ungoliant: rayon + reqwest](https://github.com/oscar-project/ungoliant/blob * [pg_mapper](cors/backend/src/main.rs) ## Community Showcase -Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres, e.g., `sqlx::postgres::PgPoolOptions` (Pg for Postgrs): +Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres, e.g., `sqlx::postgres::PgPoolOptions` (Pg for Postgres): ```rust use sqlx::postgres::PgPoolOptions; From e31329bb8a8693e0e64b7e4dd035a922b7cd9188 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 15:40:48 +0800 Subject: [PATCH 52/69] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4f60c1bb..1fda1954 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ Forked this repo to learn actix-web. ***actix + Vue is a popular and perfect combo*** +There's also a [chat sample](websockets/chat/static/index.html) parallel to Rocket's! + ---- Refactor feedback management system From 4ae1f70fa74501b5df7ff3a2c079b8cab07da1ff Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 15:54:28 +0800 Subject: [PATCH 53/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1fda1954..41e47806 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Forked this repo to learn actix-web. ***actix + Vue is a popular and perfect combo*** -There's also a [chat sample](websockets/chat/static/index.html) parallel to Rocket's! +There's also a [chat sample](websockets/chat/static/index.html) parallel to Rocket's! `const socket = new WebSocket(wsUri);` vs `const events = new EventSource(uri); events.addEventListener("message", (ev) => { ... }));` 'Exponential backoff reconnect' ---- Refactor feedback management system From b02fb3729157cae5c4c5fc91850d7c5544948e46 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 13 Nov 2024 15:55:03 +0800 Subject: [PATCH 54/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 41e47806..be213652 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ using `actix` + [thirtyfour](https://github.com/Vrtgs/thirtyfour) (`goto()`, `fi //////////////////////// // Basic features: // a. Siame Netwo Simil (Keywo Searc) -// b. Siame Netwo Simil (Dupli Remov, mostl hate comme) +// b. Siame Netwo Simil (Dupli Remov, mostl hate speec) // c. Gende // d. Natio // e. Spam Remov From ebbb4cc6ef1da9e6d5b6ed7e7e3b9dde4338f085 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Mon, 25 Nov 2024 17:07:34 +0800 Subject: [PATCH 55/69] Update README.md --- README.md | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index be213652..d9717dcc 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ There's also a [chat sample](websockets/chat/static/index.html) parallel to Rock ---- Refactor feedback management system -using `actix` + [thirtyfour](https://github.com/Vrtgs/thirtyfour) (`goto()`, `find()`, supports `send_keys()`) as backend +using `actix` + [thirtyfour](https://github.com/Vrtgs/thirtyfour) (`goto()`, `find()`, supports `send_keys()`, `By::{Id|Css}()`) as backend ```rust //////////////////////// // Sources: @@ -31,31 +31,31 @@ use std::{thread, time::Duration}; #[tokio::main] async fn main() -> WebDriverResult<()> { // <------ called by Actix, should stream progress ! - let caps = DesiredCapabilities::chrome(); - let driver = WebDriver::new("http://localhost:9515", caps).await?; - - driver.goto("https://wikipedia.org").await?; - let elem_form = driver.find(By::Id("search-form")).await?; - - let elem_text = elem_form.find(By::Id("searchInput")).await?; - - elem_text.send_keys("selenium").await?; - thread::sleep(Duration::from_millis(1500)); - elem_text.send_keys(Key::Control + "a").await?; - thread::sleep(Duration::from_millis(500)); - elem_text.send_keys("thirtyfour" + Key::Enter).await?; - - let elem_button = elem_form.find(By::Css("button[type='submit']")).await?; - elem_button.click().await?; - - // Look for header to implicitly wait for the page to load. - driver.find(By::ClassName("firstHeading")).await?; - assert_eq!(driver.title().await?, "Selenium - Wikipedia"); - - // Always explicitly close the browser. - driver.quit().await?; - - Ok(()) + let caps = DesiredCapabilities::chrome(); + let driver = WebDriver::new("http://localhost:9515", caps).await?; + + driver.goto("https://wikipedia.org").await?; + let elem_form = driver.find(By::Id("search-form")).await?; + + let elem_text = elem_form.find(By::Id("searchInput")).await?; + + elem_text.send_keys("selenium").await?; + thread::sleep(Duration::from_millis(1500)); + elem_text.send_keys(Key::Control + "a").await?; + thread::sleep(Duration::from_millis(500)); + elem_text.send_keys("thirtyfour" + Key::Enter).await?; + + let elem_button = elem_form.find(By::Css("button[type='submit']")).await?; + elem_button.click().await?; + + // Look for header to implicitly wait for the page to load. + driver.find(By::ClassName("firstHeading")).await?; + assert_eq!(driver.title().await?, "Selenium - Wikipedia"); + + // Always explicitly close the browser. + driver.quit().await?; + + Ok(()) } ``` From 6ce3ade0fae36535d07cd32ccd0a2af9e1132434 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Mon, 25 Nov 2024 17:13:59 +0800 Subject: [PATCH 56/69] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d9717dcc..2764cdb1 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ Ok(()) - [Atomic-Server](https://github.com/joepio/atomic-data-rust/): Graph database with a dynamic schema, authorization and full text search. - ***[Barricade](https://github.com/purton-tech/barricade): Quickly add user registration and logon to any application.*** - Interesting. Comes with hCaptcha too. 'Works well as a Kubernetes side car.' + - `use sqlx::PgPool;` as well. Postgres + Actix = nice combo - [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. - ***[Bloom](https://github.com/skerkour/bloom-legacy): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more.*** - [It uses Vuetify 2 (EOL) + Axios](https://github.com/skerkour/bloom-legacy/blob/fa91a0fcfb779a5657cbbbfaf9ea305e79570122/webapp/package.json) From ae50716854a93ab08fae555486308cb22d9444be Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 27 Nov 2024 09:09:57 +0800 Subject: [PATCH 57/69] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 2764cdb1..d5ed78af 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ Forked this repo to learn actix-web. -[Monorepo: Ease of code reuse](https://en.wikipedia.org/wiki/Monorepo) - ***actix + Vue is a popular and perfect combo*** There's also a [chat sample](websockets/chat/static/index.html) parallel to Rocket's! `const socket = new WebSocket(wsUri);` vs `const events = new EventSource(uri); events.addEventListener("message", (ev) => { ... }));` 'Exponential backoff reconnect' From e5387f5a9f79fe28bcede783c6279963cf7b240a Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 27 Nov 2024 09:28:27 +0800 Subject: [PATCH 58/69] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index d5ed78af..386594e0 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,6 @@ async fn main() -> WebDriverResult<()> { // <------ cal cf. [Ungoliant: rayon + reqwest](https://github.com/oscar-project/ungoliant/blob/main/Cargo.toml) (actix + thirtyfour + rayon) -## BYOT: Build Your Own Tools - ## Usage * [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new().wrap( ... ) }` ***CORS is also a [Vue ^3.3.4](https://github.com/AlexanderPoone/actix/blob/master/cors/frontend/package.json) sample !!! This is also a 'log in' sample.*** * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` From aecb73587860ca4c80628a859e545feb23ddbccd Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 27 Nov 2024 09:31:29 +0800 Subject: [PATCH 59/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 386594e0..b8e09629 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ cf. [Ungoliant: rayon + reqwest](https://github.com/oscar-project/ungoliant/blob * [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new().wrap( ... ) }` ***CORS is also a [Vue ^3.3.4](https://github.com/AlexanderPoone/actix/blob/master/cors/frontend/package.json) sample !!! This is also a 'log in' sample.*** * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` * `client.query(&stmt, &[&user_info.email, &user_info.first_name, &user_info.last_name, &user_info.username,],)` -* [pg_mapper](cors/backend/src/main.rs) +* [pg_mapper](databases/postgres/README.md) ## Community Showcase Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres, e.g., `sqlx::postgres::PgPoolOptions` (Pg for Postgres): From d943df4e013c225c21a6adf0043db7b3b4b6c223 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Wed, 27 Nov 2024 09:56:41 +0800 Subject: [PATCH 60/69] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index b8e09629..f008e8bd 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Forked this repo to learn actix-web. There's also a [chat sample](websockets/chat/static/index.html) parallel to Rocket's! `const socket = new WebSocket(wsUri);` vs `const events = new EventSource(uri); events.addEventListener("message", (ev) => { ... }));` 'Exponential backoff reconnect' ---- -Refactor feedback management system +Refactor feedback management system (Using actix + thirtyfour + rayon) (cf. [Ungoliant: rayon + reqwest](https://github.com/oscar-project/ungoliant/blob/main/Cargo.toml)) using `actix` + [thirtyfour](https://github.com/Vrtgs/thirtyfour) (`goto()`, `find()`, supports `send_keys()`, `By::{Id|Css}()`) as backend ```rust @@ -57,8 +57,6 @@ async fn main() -> WebDriverResult<()> { // <------ cal } ``` -cf. [Ungoliant: rayon + reqwest](https://github.com/oscar-project/ungoliant/blob/main/Cargo.toml) (actix + thirtyfour + rayon) - ## Usage * [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new().wrap( ... ) }` ***CORS is also a [Vue ^3.3.4](https://github.com/AlexanderPoone/actix/blob/master/cors/frontend/package.json) sample !!! This is also a 'log in' sample.*** * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` From 45c52e3d660a14319b11c17d4d9f15e4536cdcdb Mon Sep 17 00:00:00 2001 From: Lysander Poone Date: Wed, 27 Nov 2024 10:55:48 +0800 Subject: [PATCH 61/69] '.' --- databases/postgres/.gitignore | 1 - databases/postgres/Cargo.toml | 4 ++-- databases/postgres/README.md | 6 +++--- databases/postgres/src/main.rs | 10 ++++++++++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/databases/postgres/.gitignore b/databases/postgres/.gitignore index 37c8717f..53eaa219 100644 --- a/databases/postgres/.gitignore +++ b/databases/postgres/.gitignore @@ -1,3 +1,2 @@ /target **/*.rs.bk -.env diff --git a/databases/postgres/Cargo.toml b/databases/postgres/Cargo.toml index 6727cd60..29457789 100644 --- a/databases/postgres/Cargo.toml +++ b/databases/postgres/Cargo.toml @@ -5,8 +5,8 @@ edition = "2021" [dependencies] actix-web.workspace = true -confik = "0.11" -deadpool-postgres = { version = "0.12", features = ["serde"] } +confik = "0.12.0" +deadpool-postgres = { version = "0.14.0", features = ["serde"] } derive_more.workspace = true dotenvy.workspace = true serde.workspace = true diff --git a/databases/postgres/README.md b/databases/postgres/README.md index 50823706..5301e662 100644 --- a/databases/postgres/README.md +++ b/databases/postgres/README.md @@ -60,7 +60,7 @@ You may need to ensure that you are running the commands with the correct SQL us 5. Create `.env` file: ```ini - SERVER_ADDR=127.0.0.1:8080 + SERVER_ADDR=127.0.0.1:18080 PG__USER=test_user PG__PASSWORD=testing PG__HOST=127.0.0.1 @@ -78,13 +78,13 @@ You may need to ensure that you are running the commands with the correct SQL us 7. Using a different terminal send an HTTP POST request to the running server: ```shell - echo '{"email": "ferris@thecrab.com", "first_name": "ferris", "last_name": "crab", "username": "ferreal"}' | http -f --json --print h POST http://127.0.0.1:8080/users + echo '{"email": "ferris@thecrab.com", "first_name": "ferris", "last_name": "crab", "username": "ferreal"}' | http -f --json --print h POST http://127.0.0.1:18080/users ``` **...or using curl...** ```shell - curl -i -d '{"email": "ferris@thecrab.com", "first_name": "ferris", "last_name": "crab", "username": "ferreal"}' -H 'Content-Type: application/json' http://127.0.0.1:8080/users + curl -i -d "{\"email\": \"ferris@thecrab.com\", \"first_name\": \"ferris\", \"last_name\": \"crab\", \"username\": \"ferreal\"}" -H "Content-Type: application/json" http://127.0.0.1:18080/users ``` A unique constraint exists for username, so sending this request twice will return an internal server error (HTTP 500). diff --git a/databases/postgres/src/main.rs b/databases/postgres/src/main.rs index 43aa06bb..0e51f335 100644 --- a/databases/postgres/src/main.rs +++ b/databases/postgres/src/main.rs @@ -1,3 +1,5 @@ +// use std::env; + use actix_web::{web, App, Error, HttpResponse, HttpServer}; use confik::{Configuration as _, EnvSource}; use deadpool_postgres::{Client, Pool}; @@ -38,6 +40,14 @@ pub async fn add_user( async fn main() -> std::io::Result<()> { dotenv().ok(); + // env::set_var("SERVER_ADDR", "127.0.0.1:18080"); + // env::set_var("PG__USER", "test_user"); + // env::set_var("PG__PASSWORD", "testing"); + // env::set_var("PG__HOST", "127.0.0.1"); + // env::set_var("PG__PORT","5432"); + // env::set_var("PG__DBNAME","testing_db"); + // env::set_var("PG__POOL_MAX_SIZE", "16"); + let config = ExampleConfig::builder() .override_with(EnvSource::new()) .try_build() From e32f9dce41e97e933e8a699ca547703ba0a03dab Mon Sep 17 00:00:00 2001 From: Lysander Poone Date: Wed, 27 Nov 2024 11:52:50 +0800 Subject: [PATCH 62/69] . --- websockets/chat/README.md | 4 ++-- websockets/chat/client.py | 2 +- websockets/chat/src/main.rs | 17 ++++++++++++----- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/websockets/chat/README.md b/websockets/chat/README.md index db1b23a5..5ec6fbdb 100644 --- a/websockets/chat/README.md +++ b/websockets/chat/README.md @@ -20,7 +20,7 @@ Fancy shiny features: - `some message` - just string, send message to all peers in same room - client has to respond to heartbeat `Ping` messages, if server does not receive a heartbeat 'Pong' message for 10 seconds connection gets dropped -2. [http://localhost:8080/count/](http://localhost:8080/count/) is a non-websocket endpoint and will affect and display state. +2. [http://localhost:18080/count/](http://localhost:18080/count/) is a non-websocket endpoint and will affect and display state. To start server use the following @@ -31,7 +31,7 @@ cargo run --bin websocket-chat-server ## WebSocket Browser Client -- Open in browser: . +- Open in browser: . - Use two tabs to set up a proper conversation. ## Python Client using aiohttp diff --git a/websockets/chat/client.py b/websockets/chat/client.py index eb1998d2..f321b47d 100755 --- a/websockets/chat/client.py +++ b/websockets/chat/client.py @@ -58,7 +58,7 @@ async def dispatch(ws: aiohttp.ClientWebSocketResponse) -> None: "--host", action="store", dest="host", default="127.0.0.1", help="Host name" ) ARGS.add_argument( - "--port", action="store", dest="port", default=8080, type=int, help="Port number" + "--port", action="store", dest="port", default=18080, type=int, help="Port number" ) if __name__ == "__main__": diff --git a/websockets/chat/src/main.rs b/websockets/chat/src/main.rs index 0cb742db..e8ac8da0 100644 --- a/websockets/chat/src/main.rs +++ b/websockets/chat/src/main.rs @@ -1,9 +1,8 @@ use std::{ - sync::{ + env, sync::{ atomic::{AtomicUsize, Ordering}, Arc, - }, - time::Instant, + }, time::Instant }; use actix::*; @@ -40,6 +39,7 @@ async fn chat_route( } /// Displays state +/// TODO: How to do it in Rocket? There seems to have no such function in the example. async fn get_count(count: web::Data) -> impl Responder { let current_count = count.load(Ordering::SeqCst); format!("Visitors: {current_count}") @@ -57,7 +57,10 @@ async fn main() -> std::io::Result<()> { // start chat server actor let server = server::ChatServer::new(app_state.clone()).start(); - log::info!("starting HTTP server at http://localhost:8080"); + log::info!("starting HTTP server at http://localhost:18080"); + + let path = env::current_dir()?; + println!("The current directory is {}", path.display()); HttpServer::new(move || { App::new() @@ -66,11 +69,15 @@ async fn main() -> std::io::Result<()> { .service(web::resource("/").to(index)) .route("/count", web::get().to(get_count)) .route("/ws", web::get().to(chat_route)) + // Use the following: + // cargo build + // cargo run --bin websocket-chat-server + // , otherwise the pwd will be /actix .service(Files::new("/static", "./static")) .wrap(Logger::default()) }) .workers(2) - .bind(("127.0.0.1", 8080))? + .bind(("127.0.0.1", 18080))? .run() .await } From bda4cc7971e87f2f13024aaf976ddfb7852222b8 Mon Sep 17 00:00:00 2001 From: Lysander Poone Date: Wed, 27 Nov 2024 17:54:45 +0800 Subject: [PATCH 63/69] . --- Cargo.lock | 214 +++++++++++++++------------------ Cargo.toml | 14 +-- README.md | 2 +- databases/postgres/src/db.rs | 15 +-- databases/postgres/src/main.rs | 13 +- websockets/chat/src/main.rs | 6 +- websockets/chat/src/server.rs | 2 +- 7 files changed, 127 insertions(+), 139 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dba71811..6d00bdee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -218,15 +218,15 @@ dependencies = [ [[package]] name = "actix-identity" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2c99b7a5614b72a78f04aa2021e5370fc1aef2475fffeffc0c1266b99007062" +checksum = "23b8ddc6f6a8b19c4016aaa13519968da9969bc3bc1c1c883cdb0f25dd6c8cf7" dependencies = [ "actix-service", - "actix-session 0.9.0", + "actix-session", "actix-utils", "actix-web", - "derive_more 0.99.18", + "derive_more 1.0.0", "futures-core", "serde", "tracing", @@ -239,7 +239,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -277,7 +277,7 @@ dependencies = [ "parse-size", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -346,22 +346,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "actix-session" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b671404ec72194d8af58c2bdaf51e3c477a0595056bd5010148405870dda8df2" -dependencies = [ - "actix-service", - "actix-utils", - "actix-web", - "anyhow", - "derive_more 0.99.18", - "serde", - "serde_json", - "tracing", -] - [[package]] name = "actix-session" version = "0.10.1" @@ -506,14 +490,14 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] name = "actix-web-lab" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a965e3e826aa4737af33666aa09ed949aa1837706fda2adee07039347be50d6" +checksum = "ee75923689132fc5fb57ccc5bb98d25bb214796a29cd505844eb3b42daf11df0" dependencies = [ "actix-http", "actix-router", @@ -536,7 +520,6 @@ dependencies = [ "local-channel", "mediatype", "mime", - "once_cell", "pin-project-lite", "regex", "serde", @@ -550,13 +533,13 @@ dependencies = [ [[package]] name = "actix-web-lab-derive" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "008f98f5a68eeacf5e6d44ed74ce03c1b906baa53eabfb41faf0f5f40bd685f8" +checksum = "4c221da13534b9352f3f79fcbbd6095f6d8aee63bdf1da8a73d36f9eeea17d5a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -581,7 +564,7 @@ checksum = "b6ac1e58cded18cb28ddc17143c4dea5345b3ad575e14f32f66e4054a56eb271" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -893,7 +876,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -1009,7 +992,7 @@ dependencies = [ "proc-macro2", "quote", "strum", - "syn 2.0.79", + "syn 2.0.89", "thiserror", ] @@ -1065,7 +1048,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -1076,7 +1059,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -1103,7 +1086,7 @@ dependencies = [ "derive_utils", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -1707,7 +1690,7 @@ name = "basics" version = "1.0.0" dependencies = [ "actix-files", - "actix-session 0.10.1", + "actix-session", "actix-web", "actix-web-lab", "async-stream", @@ -1745,7 +1728,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.79", + "syn 2.0.89", "which", ] @@ -1764,7 +1747,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -1834,7 +1817,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", "syn_derive", ] @@ -2121,7 +2104,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -2197,9 +2180,9 @@ dependencies = [ [[package]] name = "confik" -version = "0.11.8" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43c19ecdad309c763db5a51fb7202640d2ba51cd650144e9332c3849715fe3ac" +checksum = "fcb80c5315aacb4f2a7ef6ddb6b2fe7818191e78098f5ac597372647b9958039" dependencies = [ "cfg-if", "confik-macros", @@ -2211,14 +2194,14 @@ dependencies = [ [[package]] name = "confik-macros" -version = "0.11.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7705566cfbb6c788c882847b4b82f31ffc52413c87883544d629749a88ebd34" +checksum = "370f641e4f578df8c52e7c37300d5d9d2b12be6fb6f4732b62a794e2b647d1a2" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -2282,7 +2265,7 @@ name = "cookie-auth" version = "1.0.0" dependencies = [ "actix-identity", - "actix-session 0.10.1", + "actix-session", "actix-web", "env_logger", "log", @@ -2292,7 +2275,7 @@ dependencies = [ name = "cookie-session" version = "1.0.0" dependencies = [ - "actix-session 0.10.1", + "actix-session", "actix-web", "env_logger", "log", @@ -2515,7 +2498,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -2526,7 +2509,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -2577,7 +2560,7 @@ dependencies = [ "actix-web", "confik", "deadpool-postgres", - "derive_more 0.99.18", + "derive_more 1.0.0", "dotenvy", "serde", "tokio-pg-mapper", @@ -2598,11 +2581,10 @@ dependencies = [ [[package]] name = "deadpool" -version = "0.10.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb84100978c1c7b37f09ed3ce3e5f843af02c2a2c431bae5b19230dad2c1b490" +checksum = "6541a3916932fe57768d4be0b1ffb5ec7cbf74ca8c903fdfd5c0fe8aa958f0ed" dependencies = [ - "async-trait", "deadpool-runtime", "num_cpus", "serde", @@ -2611,11 +2593,13 @@ dependencies = [ [[package]] name = "deadpool-postgres" -version = "0.12.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda39fa1cfff190d8924d447ad04fd22772c250438ca5ce1dfb3c80621c05aaa" +checksum = "1ab8a4ea925ce79678034870834602a2980f4b88c09e97feb266496dbb4493d2" dependencies = [ + "async-trait", "deadpool", + "getrandom", "serde", "tokio", "tokio-postgres", @@ -2663,7 +2647,7 @@ checksum = "8034092389675178f570469e6c3b0465d3d30b4505c294a6550db47f3c17ad18" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -2697,7 +2681,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -2717,7 +2701,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", "unicode-xid", ] @@ -2729,7 +2713,7 @@ checksum = "65f152f4b8559c4da5d574bafc7af85454d706b4c5fe8b530d508cacbb6807ea" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -2766,7 +2750,7 @@ dependencies = [ "dsl_auto_type", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -2775,7 +2759,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "209c735641a413bc68c4923a9d6ad4bcb3ca306b794edaa7eb0b3228a99ffb25" dependencies = [ - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -2798,7 +2782,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -2827,7 +2811,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -2935,7 +2919,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -2992,7 +2976,7 @@ name = "error-handling" version = "1.0.0" dependencies = [ "actix-web", - "derive_more 0.99.18", + "derive_more 1.0.0", "env_logger", "log", "rand", @@ -3156,7 +3140,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", "unic-langid", ] @@ -3262,7 +3246,7 @@ checksum = "e99b8b3c28ae0e84b604c75f721c21dc77afb3706076af5e8216d15fd1deaae3" dependencies = [ "frunk_proc_macro_helpers", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -3274,7 +3258,7 @@ dependencies = [ "frunk_core", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -3286,7 +3270,7 @@ dependencies = [ "frunk_core", "frunk_proc_macro_helpers", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -3387,7 +3371,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -4374,7 +4358,7 @@ checksum = "760dbe46660494d469023d661e8d268f413b2cb68c999975dcc237407096a693" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", "url", ] @@ -4934,7 +4918,7 @@ checksum = "3a6dbc533e93429a71c44a14c04547ac783b56d3f22e6c4f12b1b994cf93844e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -4998,7 +4982,7 @@ name = "mysql" version = "1.0.0" dependencies = [ "actix-web", - "derive_more 0.99.18", + "derive_more 1.0.0", "dotenvy", "env_logger", "log", @@ -5045,7 +5029,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", "termcolor", "thiserror", ] @@ -5315,7 +5299,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -5561,7 +5545,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -5678,14 +5662,14 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -5824,7 +5808,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" dependencies = [ "proc-macro2", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -5887,9 +5871,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -5924,7 +5908,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -5937,7 +5921,7 @@ dependencies = [ "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -6166,7 +6150,7 @@ dependencies = [ name = "redis-session-example" version = "1.0.0" dependencies = [ - "actix-session 0.10.1", + "actix-session", "actix-test", "actix-web", "env_logger", @@ -6246,9 +6230,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.8" +version = "0.12.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ "base64 0.22.1", "bytes", @@ -6352,7 +6336,7 @@ checksum = "a5a11a05ee1ce44058fa3d5961d05194fdbe3ad6b40f904af764d81b86450e6b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -6678,7 +6662,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.79", + "syn 2.0.89", "toml 0.8.19", ] @@ -6831,9 +6815,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.210" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] @@ -6849,13 +6833,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -6873,9 +6857,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.132" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "indexmap 2.5.0", "itoa", @@ -6951,7 +6935,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -7073,10 +7057,10 @@ name = "simple-auth-server" version = "1.0.0" dependencies = [ "actix-identity", - "actix-session 0.10.1", + "actix-session", "actix-web", "chrono", - "derive_more 0.99.18", + "derive_more 1.0.0", "diesel", "dotenvy", "env_logger", @@ -7496,7 +7480,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -7528,9 +7512,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" dependencies = [ "proc-macro2", "quote", @@ -7546,7 +7530,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -7691,7 +7675,7 @@ name = "templating-yarte" version = "1.0.0" dependencies = [ "actix-web", - "derive_more 0.99.18", + "derive_more 1.0.0", "env_logger", "log", "yarte", @@ -7766,7 +7750,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -7897,7 +7881,7 @@ checksum = "8d9ef545650e79f30233c0003bcc2504d7efac6dad25fca40744de773fe2049c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -7905,7 +7889,7 @@ name = "todo" version = "1.0.0" dependencies = [ "actix-files", - "actix-session 0.10.1", + "actix-session", "actix-web", "dotenvy", "env_logger", @@ -7951,7 +7935,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -8242,7 +8226,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -8502,7 +8486,7 @@ checksum = "1ed7f4237ba393424195053097c1516bd4590dc82b84f2f97c5c69e12704555b" dependencies = [ "proc-macro-hack", "quote", - "syn 2.0.79", + "syn 2.0.89", "unic-langid-impl", ] @@ -8705,7 +8689,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -8785,7 +8769,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", "wasm-bindgen-shared", ] @@ -8819,7 +8803,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -9498,7 +9482,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] @@ -9518,7 +9502,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.89", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 3018b54f..84e29372 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,7 +84,7 @@ actix-codec = "0.5" actix-cors = "0.7" actix-files = "0.6" actix-http = "3.5" -actix-identity = "0.7" +actix-identity = "0.8.0" actix-multipart = "0.7" actix-protobuf = "0.11" actix-session = "0.10" @@ -93,12 +93,12 @@ actix-tls = "3.4" actix-utils = "3" actix-web = "4.9" actix-web-actors = "4.1" -actix-web-lab = "0.22" +actix-web-lab = "0.23.0" actix-ws = "0.3" awc = "3.2" chrono = { version = "0.4.30", features = ["serde"] } -derive_more = "0.99.7" +derive_more = "1.0.0" dotenvy = "0.15" env_logger = "0.11" eyre = { version = "0.6", default-features = false, features = ["auto-install", "track-caller"] } @@ -107,13 +107,13 @@ futures-util = { version = "0.3.17", default-features = false, features = ["std" log = "0.4" openssl = { version = "0.10.60", features = ["v110"] } parking_lot = "0.12" -pin-project-lite = "0.2" +pin-project-lite = "0.2.15" rand = "0.8" -reqwest = { version = "0.12", features = ["json", "stream"] } +reqwest = { version = "0.12.9", features = ["json", "stream"] } rustls = "0.23" rustls-pemfile = "2" -serde = { version = "1", features = ["derive"] } -serde_json = "1" +serde = { version = "1.0.215", features = ["derive"] } +serde_json = "1.0.133" time = "0.3" tokio = { version = "1.24.2", features = ["sync", "io-util"] } tokio-util = "0.7.4" diff --git a/README.md b/README.md index f008e8bd..b72b8069 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ async fn main() -> WebDriverResult<()> { // <------ cal * [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new().wrap( ... ) }` ***CORS is also a [Vue ^3.3.4](https://github.com/AlexanderPoone/actix/blob/master/cors/frontend/package.json) sample !!! This is also a 'log in' sample.*** * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` * `client.query(&stmt, &[&user_info.email, &user_info.first_name, &user_info.last_name, &user_info.username,],)` -* [pg_mapper](databases/postgres/README.md) +* [pg_mapper](databases/postgres/src/models.rs) ## Community Showcase Many of these repos use [SQLX](https://github.com/launchbadge/sqlx) for Postgres, e.g., `sqlx::postgres::PgPoolOptions` (Pg for Postgres): diff --git a/databases/postgres/src/db.rs b/databases/postgres/src/db.rs index 0b15b061..fc12e6a3 100644 --- a/databases/postgres/src/db.rs +++ b/databases/postgres/src/db.rs @@ -1,7 +1,7 @@ use deadpool_postgres::Client; use tokio_pg_mapper::FromTokioPostgresRow; -use crate::{errors::MyError, models::User}; +use crate::{errors::MyError, models::User}; // import self pub async fn get_users(client: &Client) -> Result, MyError> { let stmt = include_str!("../sql/get_users.sql"); @@ -18,15 +18,16 @@ pub async fn get_users(client: &Client) -> Result, MyError> { Ok(results) } -pub async fn add_user(client: &Client, user_info: User) -> Result { - let _stmt = include_str!("../sql/add_user.sql"); - let _stmt = _stmt.replace("$table_fields", &User::sql_table_fields()); - let stmt = client.prepare(&_stmt).await.unwrap(); +pub async fn add_user(client: &Client, user_info: User) -> Result { // remember it's `async fn` + let _stmt = include_str!("../sql/add_user.sql"); // This is a one-liner to get file content ! + let _stmt = _stmt.replace("$table_fields", &User::sql_table_fields()); // return all columns, no need to hard code return column names + // but you need to hard code column names to query + let stmt = client.prepare(&_stmt).await.unwrap(); // Create 'prepared statement' which allows parameters - client + client // tokio_postgres::client::Client .query( &stmt, - &[ + &[ // Nice, it's parameterised ! $1 $2 $3 $4 &user_info.email, &user_info.first_name, &user_info.last_name, diff --git a/databases/postgres/src/main.rs b/databases/postgres/src/main.rs index 0e51f335..7cb25ebc 100644 --- a/databases/postgres/src/main.rs +++ b/databases/postgres/src/main.rs @@ -15,11 +15,13 @@ mod models; use self::{errors::MyError, models::User}; +// Every statement should take db_pool as parameter pub async fn get_users(db_pool: web::Data) -> Result { let client: Client = db_pool.get().await.map_err(MyError::PoolError)?; let users = db::get_users(&client).await?; + // actix Ok () inside rust Ok (Result) Ok(HttpResponse::Ok().json(users)) } @@ -38,7 +40,7 @@ pub async fn add_user( #[actix_web::main] async fn main() -> std::io::Result<()> { - dotenv().ok(); + dotenv().ok(); // reads from `.env` file // env::set_var("SERVER_ADDR", "127.0.0.1:18080"); // env::set_var("PG__USER", "test_user"); @@ -53,13 +55,14 @@ async fn main() -> std::io::Result<()> { .try_build() .unwrap(); + // The db_pool used is `deadpool` let pool = config.pg.create_pool(None, NoTls).unwrap(); - let server = HttpServer::new(move || { + let server = HttpServer::new(move || { // memorise the boilerplate App::new().app_data(web::Data::new(pool.clone())).service( - web::resource("/users") - .route(web::post().to(add_user)) - .route(web::get().to(get_users)), + web::resource("/users") // same path "Creates a new resource for a specific path." + .route(web::post().to(add_user)) // but POST method + .route(web::get().to(get_users)), // but GET method ) }) .bind(config.server_addr.clone())? diff --git a/websockets/chat/src/main.rs b/websockets/chat/src/main.rs index e8ac8da0..5b5c2b29 100644 --- a/websockets/chat/src/main.rs +++ b/websockets/chat/src/main.rs @@ -10,6 +10,7 @@ use actix_files::{Files, NamedFile}; use actix_web::{ middleware::Logger, web, App, Error, HttpRequest, HttpResponse, HttpServer, Responder, }; +// `actix_web_actors` is deprecated. Use `actix_ws` instead. WebSockets for Actix Web, without actors. use actix_web_actors::ws; mod server; @@ -48,7 +49,7 @@ async fn get_count(count: web::Data) -> impl Responder { // the actor-based WebSocket examples REQUIRE `actix_web::main` for actor support #[actix_web::main] async fn main() -> std::io::Result<()> { - env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); + env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); // e.g. [2017-11-09T02:12:24Z ERROR main] this is printed by default // set up applications state // keep a count of the number of visitors @@ -70,8 +71,7 @@ async fn main() -> std::io::Result<()> { .route("/count", web::get().to(get_count)) .route("/ws", web::get().to(chat_route)) // Use the following: - // cargo build - // cargo run --bin websocket-chat-server + // cargo build; cargo run --bin websocket-chat-server // , otherwise the pwd will be /actix .service(Files::new("/static", "./static")) .wrap(Logger::default()) diff --git a/websockets/chat/src/server.rs b/websockets/chat/src/server.rs index fe0f7958..f442250c 100644 --- a/websockets/chat/src/server.rs +++ b/websockets/chat/src/server.rs @@ -119,7 +119,7 @@ impl Handler for ChatServer { type Result = usize; fn handle(&mut self, msg: Connect, _: &mut Context) -> Self::Result { - println!("Someone joined"); + println!("Someone joined"); // TOOD: username? // notify all users in same room self.send_message("main", "Someone joined", 0); From c341eb020b7aa49bdfa06838633cb1ed22104ae2 Mon Sep 17 00:00:00 2001 From: Lysander Poone Date: Wed, 27 Nov 2024 17:58:05 +0800 Subject: [PATCH 64/69] . --- websockets/chat/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/websockets/chat/src/main.rs b/websockets/chat/src/main.rs index 5b5c2b29..fa016ba9 100644 --- a/websockets/chat/src/main.rs +++ b/websockets/chat/src/main.rs @@ -76,7 +76,7 @@ async fn main() -> std::io::Result<()> { .service(Files::new("/static", "./static")) .wrap(Logger::default()) }) - .workers(2) + .workers(2) // <-------------------------------- WORKERS .bind(("127.0.0.1", 18080))? .run() .await From edd5021ce89b1e71564cbbb8cf0b30137e86b493 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Mon, 30 Dec 2024 09:50:45 +0800 Subject: [PATCH 65/69] Update README.md --- README.md | 58 +++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index b72b8069..ddeb2f40 100644 --- a/README.md +++ b/README.md @@ -81,39 +81,39 @@ assert_eq!(row.0, 150); Ok(()) ``` -- [Actix-Web Shuttle Template](https://github.com/sentinel1909/shuttle-templat-actix): A somewhat opinionated template for getting started with an Actix Web API and hosting it on Shuttle. -- [Atomic-Server](https://github.com/joepio/atomic-data-rust/): Graph database with a dynamic schema, authorization and full text search. -- ***[Barricade](https://github.com/purton-tech/barricade): Quickly add user registration and logon to any application.*** +- [Actix-Web Shuttle Template](https://github.com/sentinel1909/shuttle-templat-actix/Cargo.toml): A somewhat opinionated template for getting started with an Actix Web API and hosting it on Shuttle. +- [Atomic-Server](https://github.com/joepio/atomic-data-rust/Cargo.toml): Graph database with a dynamic schema, authorization and full text search. +- ***[Barricade](https://github.com/purton-tech/barricade/Cargo.toml): Quickly add user registration and logon to any application.*** - Interesting. Comes with hCaptcha too. 'Works well as a Kubernetes side car.' - `use sqlx::PgPool;` as well. Postgres + Actix = nice combo -- [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. -- ***[Bloom](https://github.com/skerkour/bloom-legacy): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more.*** +- [binserve](https://github.com/mufeedvh/binserve/Cargo.toml): A fast, secure, and easy to set up static web server written on top of Actix Web with routing, templating, and various other features. +- ***[Bloom](https://github.com/skerkour/bloom-legacy/Cargo.toml): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more.*** - [It uses Vuetify 2 (EOL) + Axios](https://github.com/skerkour/bloom-legacy/blob/fa91a0fcfb779a5657cbbbfaf9ea305e79570122/webapp/package.json) -- [Contile](https://github.com/mozilla-services/contile): The back-end server for the Mozilla Tile Service (MTS). -- [Dalted](https://github.com/carrascomj/dalted): Simple webapp that showcases the integration of [image-rs](https://github.com/image-rs/image) with Actix Web for color blindness simulations. -- [Four in a Row - Server](https://github.com/ffactory-ofcl/fourinarow-server): An online version of the popular game four in a row, written in Rust on the server side and Flutter + Dart on the client. -- [gcs-proxy](https://github.com/guaychou/gcs-proxy): A Google Cloud Storage download proxy -- [GitArena](https://github.com/mellowagain/gitarena): Software development platform with built-in VCS, issue tracking and code review. +- [Contile](https://github.com/mozilla-services/contile/Cargo.toml): The back-end server for the Mozilla Tile Service (MTS). +- [Dalted](https://github.com/carrascomj/dalted/Cargo.toml): Simple webapp that showcases the integration of [image-rs](https://github.com/image-rs/image) with Actix Web for color blindness simulations. +- [Four in a Row - Server](https://github.com/ffactory-ofcl/fourinarow-server/Cargo.toml): An online version of the popular game four in a row, written in Rust on the server side and Flutter + Dart on the client. +- [gcs-proxy](https://github.com/guaychou/gcs-proxy/Cargo.toml): A Google Cloud Storage download proxy +- [GitArena](https://github.com/mellowagain/gitarena/Cargo.toml): Software development platform with built-in VCS, issue tracking and code review. - vs. GitLab self-hosted, and Gitea (written in Go, 45k stars) -- [hyperswitch](https://github.com/juspay/hyperswitch): An Open Source Financial Switch to make payment open, fast, secure and reliable. -- ***[Labrinth](https://github.com/modrinth/labrinth): Rust-based backend to serve the `modrinth` API.*** -- [lemmy](https://github.com/dessalines/lemmy): A federated alternative to reddit in Rust. -- [Martin](https://github.com/maplibre/martin): Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server. -- ***[mCaptcha](https://github.com/mCaptcha/mCaptcha/): Proof of work based, privacy focused, libre CAPTCHA system. Crates used: `actix-web`, `sqlx`, `redis`, and `lettre`.*** -- [MeiliSearch](https://github.com/meilisearch/MeiliSearch): Fast, Relevant and Typo-Tolerant Search Engine. Open source alternative to Algolia. -- [Merino](https://github.com/mozilla-services/merino): Web service for Firefox Suggest. -- [Nitro Repo](https://github.com/wherkamp/nitro_repo): An open source ***artifact (build output)*** manager. ***Rust back-end and Vue front-end.*** -- [Operator](https://github.com/mkantor/operator): A web server for static and dynamic content. -- [pict-rs](https://git.asonix.dog/asonix/pict-rs): An image host API service -- [RCOS Telescope](https://github.com/rcos/Telescope): The RCOS (Ren,sse`lae,r /rɛnsəˈlɪər/ Polytechnic Institute) website and Discord bot. -- [Roseline](https://github.com/DoumanAsh/roseline.rs): A personal web site and discord & ***IRC (Internet relay chat)*** bot to access simple SQLite database. Demonstrates usage of various Actix and Actix Web concepts. -- [rustus](https://github.com/s3rius/rustus): A ***[TUS - the open protocol for resumable file uploads](https://github.com/tus/tusd)*** implementation that helps you handle file uploads -- [rustypaste](https://github.com/orhun/rustypaste): A minimal file upload/pastebin service -- [tokei.rs](https://github.com/XAMPPRocky/tokei_rs): The tokei.rs server code. -- [trieve](https://github.com/devflowinc/trieve): All-in-one infrastructure for building search, recommendations, and ***Retrieval Augmented Generation (RAG)***. -- [Triox](https://github.com/Trioxidation/Triox): A free file hosting server that focuses on speed, reliability and security. -- [WebThings Registration Server](https://github.com/WebThingsIO/registration_server): Exposes an HTTP API that lets you register a WebThings Gateway for tunneling support -- [Zero2prod](https://github.com/LukeMathWalker/zero-to-production/): Source code of zero to production book [zero2prod.com](https://www.zero2prod.com). Paid book but some of the chapters are available online for free. The book compares and explains the chosen technologies, like Actix Web and SQLx. +- [hyperswitch](https://github.com/juspay/hyperswitch/Cargo.toml): An Open Source Financial Switch to make payment open, fast, secure and reliable. +- ***[Labrinth](https://github.com/modrinth/labrinth/Cargo.toml): Rust-based backend to serve the `modrinth` API.*** +- [lemmy](https://github.com/dessalines/lemmy/Cargo.toml): A federated alternative to reddit in Rust. +- [Martin](https://github.com/maplibre/martin/Cargo.toml): Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server. +- ***[mCaptcha](https://github.com/mCaptcha/mCaptcha/Cargo.toml): Proof of work based, privacy focused, libre CAPTCHA system. Crates used: `actix-web`, `sqlx`, `redis`, and `lettre`.*** +- [MeiliSearch](https://github.com/meilisearch/MeiliSearch/Cargo.toml): Fast, Relevant and Typo-Tolerant Search Engine. Open source alternative to Algolia. +- [Merino](https://github.com/mozilla-services/merino/Cargo.toml): Web service for Firefox Suggest. +- [Nitro Repo](https://github.com/wherkamp/nitro_repo/Cargo.toml): An open source ***artifact (build output)*** manager. ***Rust back-end and Vue front-end.*** +- [Operator](https://github.com/mkantor/operator/Cargo.toml): A web server for static and dynamic content. +- [pict-rs](https://git.asonix.dog/asonix/pict-rs/Cargo.toml): An image host API service +- [RCOS Telescope](https://github.com/rcos/Telescope/Cargo.toml): The RCOS (Ren,sse`lae,r /rɛnsəˈlɪər/ Polytechnic Institute) website and Discord bot. +- [Roseline](https://github.com/DoumanAsh/roseline.rs/Cargo.toml): A personal web site and discord & ***IRC (Internet relay chat)*** bot to access simple SQLite database. Demonstrates usage of various Actix and Actix Web concepts. +- [rustus](https://github.com/s3rius/rustus/Cargo.toml): A ***[TUS - the open protocol for resumable file uploads](https://github.com/tus/tusd)*** implementation that helps you handle file uploads +- [rustypaste](https://github.com/orhun/rustypaste/Cargo.toml): A minimal file upload/pastebin service +- [tokei.rs](https://github.com/XAMPPRocky/tokei_rs/Cargo.toml): The tokei.rs server code. +- [trieve](https://github.com/devflowinc/trieve/Cargo.toml): All-in-one infrastructure for building search, recommendations, and ***Retrieval Augmented Generation (RAG)***. +- [Triox](https://github.com/Trioxidation/Triox/Cargo.toml): A free file hosting server that focuses on speed, reliability and security. +- [WebThings Registration Server](https://github.com/WebThingsIO/registration_server/Cargo.toml): Exposes an HTTP API that lets you register a WebThings Gateway for tunneling support +- [Zero2prod](https://github.com/LukeMathWalker/zero-to-production/Cargo.toml): Source code of zero to production book [zero2prod.com](https://www.zero2prod.com). Paid book but some of the chapters are available online for free. The book compares and explains the chosen technologies, like Actix Web and SQLx. ## Community Articles, Example Apps, Starters & Boilerplate Projects From 6e529b01642a424c4412f481cd0011ed65f17155 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Mon, 30 Dec 2024 09:52:22 +0800 Subject: [PATCH 66/69] Update README.md --- README.md | 58 +++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index ddeb2f40..9e26e15f 100644 --- a/README.md +++ b/README.md @@ -81,39 +81,39 @@ assert_eq!(row.0, 150); Ok(()) ``` -- [Actix-Web Shuttle Template](https://github.com/sentinel1909/shuttle-templat-actix/Cargo.toml): A somewhat opinionated template for getting started with an Actix Web API and hosting it on Shuttle. -- [Atomic-Server](https://github.com/joepio/atomic-data-rust/Cargo.toml): Graph database with a dynamic schema, authorization and full text search. -- ***[Barricade](https://github.com/purton-tech/barricade/Cargo.toml): Quickly add user registration and logon to any application.*** +- [Actix-Web Shuttle Template](https://github.com/sentinel1909/shuttle-templat-actix/blob/master/Cargo.toml): A somewhat opinionated template for getting started with an Actix Web API and hosting it on Shuttle. +- [Atomic-Server](https://github.com/joepio/atomic-data-rust/blob/master/Cargo.toml): Graph database with a dynamic schema, authorization and full text search. +- ***[Barricade](https://github.com/purton-tech/barricade/blob/master/Cargo.toml): Quickly add user registration and logon to any application.*** - Interesting. Comes with hCaptcha too. 'Works well as a Kubernetes side car.' - `use sqlx::PgPool;` as well. Postgres + Actix = nice combo -- [binserve](https://github.com/mufeedvh/binserve/Cargo.toml): A fast, secure, and easy to set up static web server written on top of Actix Web with routing, templating, and various other features. -- ***[Bloom](https://github.com/skerkour/bloom-legacy/Cargo.toml): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more.*** +- [binserve](https://github.com/mufeedvh/binserve/blob/master/Cargo.toml): A fast, secure, and easy to set up static web server written on top of Actix Web with routing, templating, and various other features. +- ***[Bloom](https://github.com/skerkour/bloom-legacy/blob/master/Cargo.toml): The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more.*** - [It uses Vuetify 2 (EOL) + Axios](https://github.com/skerkour/bloom-legacy/blob/fa91a0fcfb779a5657cbbbfaf9ea305e79570122/webapp/package.json) -- [Contile](https://github.com/mozilla-services/contile/Cargo.toml): The back-end server for the Mozilla Tile Service (MTS). -- [Dalted](https://github.com/carrascomj/dalted/Cargo.toml): Simple webapp that showcases the integration of [image-rs](https://github.com/image-rs/image) with Actix Web for color blindness simulations. -- [Four in a Row - Server](https://github.com/ffactory-ofcl/fourinarow-server/Cargo.toml): An online version of the popular game four in a row, written in Rust on the server side and Flutter + Dart on the client. -- [gcs-proxy](https://github.com/guaychou/gcs-proxy/Cargo.toml): A Google Cloud Storage download proxy -- [GitArena](https://github.com/mellowagain/gitarena/Cargo.toml): Software development platform with built-in VCS, issue tracking and code review. +- [Contile](https://github.com/mozilla-services/contile/blob/master/Cargo.toml): The back-end server for the Mozilla Tile Service (MTS). +- [Dalted](https://github.com/carrascomj/dalted/blob/master/Cargo.toml): Simple webapp that showcases the integration of [image-rs](https://github.com/image-rs/image) with Actix Web for color blindness simulations. +- [Four in a Row - Server](https://github.com/ffactory-ofcl/fourinarow-server/blob/master/Cargo.toml): An online version of the popular game four in a row, written in Rust on the server side and Flutter + Dart on the client. +- [gcs-proxy](https://github.com/guaychou/gcs-proxy/blob/master/Cargo.toml): A Google Cloud Storage download proxy +- [GitArena](https://github.com/mellowagain/gitarena/blob/master/Cargo.toml): Software development platform with built-in VCS, issue tracking and code review. - vs. GitLab self-hosted, and Gitea (written in Go, 45k stars) -- [hyperswitch](https://github.com/juspay/hyperswitch/Cargo.toml): An Open Source Financial Switch to make payment open, fast, secure and reliable. -- ***[Labrinth](https://github.com/modrinth/labrinth/Cargo.toml): Rust-based backend to serve the `modrinth` API.*** -- [lemmy](https://github.com/dessalines/lemmy/Cargo.toml): A federated alternative to reddit in Rust. -- [Martin](https://github.com/maplibre/martin/Cargo.toml): Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server. -- ***[mCaptcha](https://github.com/mCaptcha/mCaptcha/Cargo.toml): Proof of work based, privacy focused, libre CAPTCHA system. Crates used: `actix-web`, `sqlx`, `redis`, and `lettre`.*** -- [MeiliSearch](https://github.com/meilisearch/MeiliSearch/Cargo.toml): Fast, Relevant and Typo-Tolerant Search Engine. Open source alternative to Algolia. -- [Merino](https://github.com/mozilla-services/merino/Cargo.toml): Web service for Firefox Suggest. -- [Nitro Repo](https://github.com/wherkamp/nitro_repo/Cargo.toml): An open source ***artifact (build output)*** manager. ***Rust back-end and Vue front-end.*** -- [Operator](https://github.com/mkantor/operator/Cargo.toml): A web server for static and dynamic content. -- [pict-rs](https://git.asonix.dog/asonix/pict-rs/Cargo.toml): An image host API service -- [RCOS Telescope](https://github.com/rcos/Telescope/Cargo.toml): The RCOS (Ren,sse`lae,r /rɛnsəˈlɪər/ Polytechnic Institute) website and Discord bot. -- [Roseline](https://github.com/DoumanAsh/roseline.rs/Cargo.toml): A personal web site and discord & ***IRC (Internet relay chat)*** bot to access simple SQLite database. Demonstrates usage of various Actix and Actix Web concepts. -- [rustus](https://github.com/s3rius/rustus/Cargo.toml): A ***[TUS - the open protocol for resumable file uploads](https://github.com/tus/tusd)*** implementation that helps you handle file uploads -- [rustypaste](https://github.com/orhun/rustypaste/Cargo.toml): A minimal file upload/pastebin service -- [tokei.rs](https://github.com/XAMPPRocky/tokei_rs/Cargo.toml): The tokei.rs server code. -- [trieve](https://github.com/devflowinc/trieve/Cargo.toml): All-in-one infrastructure for building search, recommendations, and ***Retrieval Augmented Generation (RAG)***. -- [Triox](https://github.com/Trioxidation/Triox/Cargo.toml): A free file hosting server that focuses on speed, reliability and security. -- [WebThings Registration Server](https://github.com/WebThingsIO/registration_server/Cargo.toml): Exposes an HTTP API that lets you register a WebThings Gateway for tunneling support -- [Zero2prod](https://github.com/LukeMathWalker/zero-to-production/Cargo.toml): Source code of zero to production book [zero2prod.com](https://www.zero2prod.com). Paid book but some of the chapters are available online for free. The book compares and explains the chosen technologies, like Actix Web and SQLx. +- [hyperswitch](https://github.com/juspay/hyperswitch/blob/master/Cargo.toml): An Open Source Financial Switch to make payment open, fast, secure and reliable. +- ***[Labrinth](https://github.com/modrinth/labrinth/blob/master/Cargo.toml): Rust-based backend to serve the `modrinth` API.*** +- [lemmy](https://github.com/dessalines/lemmy/blob/master/Cargo.toml): A federated alternative to reddit in Rust. +- [Martin](https://github.com/maplibre/martin/blob/master/Cargo.toml): Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server. +- ***[mCaptcha](https://github.com/mCaptcha/mCaptcha/blob/master/Cargo.toml): Proof of work based, privacy focused, libre CAPTCHA system. Crates used: `actix-web`, `sqlx`, `redis`, and `lettre`.*** +- [MeiliSearch](https://github.com/meilisearch/MeiliSearch/blob/master/Cargo.toml): Fast, Relevant and Typo-Tolerant Search Engine. Open source alternative to Algolia. +- [Merino](https://github.com/mozilla-services/merino/blob/master/Cargo.toml): Web service for Firefox Suggest. +- [Nitro Repo](https://github.com/wherkamp/nitro_repo/blob/master/Cargo.toml): An open source ***artifact (build output)*** manager. ***Rust back-end and Vue front-end.*** +- [Operator](https://github.com/mkantor/operator/blob/master/Cargo.toml): A web server for static and dynamic content. +- [pict-rs](https://git.asonix.dog/asonix/pict-rs/blob/master/Cargo.toml): An image host API service +- [RCOS Telescope](https://github.com/rcos/Telescope/blob/master/Cargo.toml): The RCOS (Ren,sse`lae,r /rɛnsəˈlɪər/ Polytechnic Institute) website and Discord bot. +- [Roseline](https://github.com/DoumanAsh/roseline.rs/blob/master/Cargo.toml): A personal web site and discord & ***IRC (Internet relay chat)*** bot to access simple SQLite database. Demonstrates usage of various Actix and Actix Web concepts. +- [rustus](https://github.com/s3rius/rustus/blob/master/Cargo.toml): A ***[TUS - the open protocol for resumable file uploads](https://github.com/tus/tusd)*** implementation that helps you handle file uploads +- [rustypaste](https://github.com/orhun/rustypaste/blob/master/Cargo.toml): A minimal file upload/pastebin service +- [tokei.rs](https://github.com/XAMPPRocky/tokei_rs/blob/master/Cargo.toml): The tokei.rs server code. +- [trieve](https://github.com/devflowinc/trieve/blob/master/Cargo.toml): All-in-one infrastructure for building search, recommendations, and ***Retrieval Augmented Generation (RAG)***. +- [Triox](https://github.com/Trioxidation/Triox/blob/master/Cargo.toml): A free file hosting server that focuses on speed, reliability and security. +- [WebThings Registration Server](https://github.com/WebThingsIO/registration_server/blob/master/Cargo.toml): Exposes an HTTP API that lets you register a WebThings Gateway for tunneling support +- [Zero2prod](https://github.com/LukeMathWalker/zero-to-production/blob/master/Cargo.toml): Source code of zero to production book [zero2prod.com](https://www.zero2prod.com). Paid book but some of the chapters are available online for free. The book compares and explains the chosen technologies, like Actix Web and SQLx. ## Community Articles, Example Apps, Starters & Boilerplate Projects From d9a9161fc5ff3cfdc05de8016151f84083347cb4 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Mon, 30 Dec 2024 09:55:17 +0800 Subject: [PATCH 67/69] Update README.md --- README.md | 56 ------------------------------------------------------- 1 file changed, 56 deletions(-) diff --git a/README.md b/README.md index 9e26e15f..7d96a5cd 100644 --- a/README.md +++ b/README.md @@ -1,62 +1,6 @@ Forked this repo to learn actix-web. -***actix + Vue is a popular and perfect combo*** - -There's also a [chat sample](websockets/chat/static/index.html) parallel to Rocket's! `const socket = new WebSocket(wsUri);` vs `const events = new EventSource(uri); events.addEventListener("message", (ev) => { ... }));` 'Exponential backoff reconnect' - ----- -Refactor feedback management system (Using actix + thirtyfour + rayon) (cf. [Ungoliant: rayon + reqwest](https://github.com/oscar-project/ungoliant/blob/main/Cargo.toml)) - -using `actix` + [thirtyfour](https://github.com/Vrtgs/thirtyfour) (`goto()`, `find()`, supports `send_keys()`, `By::{Id|Css}()`) as backend -```rust -//////////////////////// -// Sources: -// 1. GoMa -// 2. TrAd (bit trickier. searchbox can't be triggered) -// 3. TrPi -//////////////////////// -// Basic features: -// a. Siame Netwo Simil (Keywo Searc) -// b. Siame Netwo Simil (Dupli Remov, mostl hate speec) -// c. Gende -// d. Natio -// e. Spam Remov -//////////////////////// - -use thirtyfour::prelude::*; -use std::{thread, time::Duration}; - -#[tokio::main] -async fn main() -> WebDriverResult<()> { // <------ called by Actix, should stream progress ! - let caps = DesiredCapabilities::chrome(); - let driver = WebDriver::new("http://localhost:9515", caps).await?; - - driver.goto("https://wikipedia.org").await?; - let elem_form = driver.find(By::Id("search-form")).await?; - - let elem_text = elem_form.find(By::Id("searchInput")).await?; - - elem_text.send_keys("selenium").await?; - thread::sleep(Duration::from_millis(1500)); - elem_text.send_keys(Key::Control + "a").await?; - thread::sleep(Duration::from_millis(500)); - elem_text.send_keys("thirtyfour" + Key::Enter).await?; - - let elem_button = elem_form.find(By::Css("button[type='submit']")).await?; - elem_button.click().await?; - - // Look for header to implicitly wait for the page to load. - driver.find(By::ClassName("firstHeading")).await?; - assert_eq!(driver.title().await?, "Selenium - Wikipedia"); - - // Always explicitly close the browser. - driver.quit().await?; - - Ok(()) -} -``` - ## Usage * [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new().wrap( ... ) }` ***CORS is also a [Vue ^3.3.4](https://github.com/AlexanderPoone/actix/blob/master/cors/frontend/package.json) sample !!! This is also a 'log in' sample.*** * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` From 621fd911f5d6f3fe08cbdf91f3cb33ae3c5183e7 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Mon, 30 Dec 2024 09:57:44 +0800 Subject: [PATCH 68/69] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 7d96a5cd..a3d22c27 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ Forked this repo to learn actix-web. +***actix + Vue is a popular and perfect combo*** + +There's also a [chat sample](websockets/chat/static/index.html) parallel to Rocket's! `const socket = new WebSocket(wsUri);` vs `const events = new EventSource(uri); events.addEventListener("message", (ev) => { ... }));` 'Exponential backoff reconnect' + ## Usage * [actix_cors::Cors::default()](cors/backend/src/main.rs) `move || { App::new().wrap( ... ) }` ***CORS is also a [Vue ^3.3.4](https://github.com/AlexanderPoone/actix/blob/master/cors/frontend/package.json) sample !!! This is also a 'log in' sample.*** * [deadpool_postgres::Client.prepare(&_stmt)](databases/postgres/src/db.rs) `-> Result, MyError>` From 1e1ebe14533b1265e8fb0c362d3123724bec5a08 Mon Sep 17 00:00:00 2001 From: Alex Poone Date: Mon, 30 Dec 2024 09:58:14 +0800 Subject: [PATCH 69/69] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a3d22c27..22d838eb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Forked this repo to learn actix-web. -***actix + Vue is a popular and perfect combo*** +What I've learned: ***actix + Vue is a popular and perfect combo*** There's also a [chat sample](websockets/chat/static/index.html) parallel to Rocket's! `const socket = new WebSocket(wsUri);` vs `const events = new EventSource(uri); events.addEventListener("message", (ev) => { ... }));` 'Exponential backoff reconnect'