├── integration-tests ├── frontend-tests │ ├── cypress │ │ ├── cypress.json │ │ ├── fixtures │ │ │ └── example.json │ │ ├── support │ │ │ └── e2e.js │ │ └── plugins │ │ │ └── index.js │ ├── package.json │ ├── Dockerfile │ ├── cypress.config.js │ └── package-lock.json └── backend-tests │ ├── Dockerfile │ ├── .env-example │ ├── knexfile.js │ └── package.json ├── frontend ├── js │ └── vue │ │ ├── .browserslistrc │ │ ├── vue.config.js │ │ ├── Dockerfile │ │ ├── babel.config.js │ │ ├── public │ │ └── favicon.ico │ │ ├── src │ │ ├── assets │ │ │ └── logo.png │ │ ├── main.js │ │ ├── components │ │ │ ├── FormTextArea.vue │ │ │ └── FormInput.vue │ │ └── router │ │ │ └── index.js │ │ ├── .gitignore │ │ ├── README.md │ │ ├── .eslintrc.js │ │ └── package.json └── rust │ └── yew │ ├── lessons │ ├── callbacks │ │ ├── src │ │ │ ├── components │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ └── mod.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── enum_properties │ │ ├── src │ │ │ ├── components │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ └── mod.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── setting_up_yewdux │ │ ├── src │ │ │ ├── stores │ │ │ │ ├── mod.rs │ │ │ │ └── counter_store.rs │ │ │ ├── main.rs │ │ │ ├── lib.rs │ │ │ └── display_count.rs │ │ ├── README.md │ │ ├── Cargo.toml │ │ └── index.html │ ├── yewdux_functional │ │ ├── src │ │ │ ├── store │ │ │ │ ├── mod.rs │ │ │ │ └── auth_store.rs │ │ │ ├── main.rs │ │ │ ├── lib.rs │ │ │ └── display_auth.rs │ │ ├── README.md │ │ ├── Cargo.toml │ │ └── index.html │ ├── set_timeout │ │ ├── src │ │ │ ├── api │ │ │ │ ├── base_api_uri.txt │ │ │ │ └── mod.rs │ │ │ ├── main.rs │ │ │ ├── router.rs │ │ │ ├── store.rs │ │ │ └── display.rs │ │ ├── index.html │ │ └── Cargo.toml │ ├── use_state │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── custom_form.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ └── text_input.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── creating_a_form │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── custom_form.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ └── text_input.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── multiple_states │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ └── mod.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ └── text_input.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── use_effect_hook │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ └── mod.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ └── text_input.rs │ │ │ ├── main.rs │ │ │ └── main.css │ │ ├── Cargo.toml │ │ └── index.html │ ├── handling_static_files │ │ ├── src │ │ │ ├── api │ │ │ │ ├── base_api_uri.txt │ │ │ │ └── mod.rs │ │ │ ├── main.rs │ │ │ ├── router.rs │ │ │ ├── store.rs │ │ │ └── display.rs │ │ ├── static │ │ │ └── xilbe_cool.png │ │ ├── index.html │ │ └── Cargo.toml │ ├── linking_to_pages │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ └── mod.rs │ │ │ │ ├── pages │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── hello.rs │ │ │ │ │ └── home.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ └── text_input.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── router.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── passing_properties_into_components │ │ ├── src │ │ │ ├── components │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── main_title.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── struct_components │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ └── mod.rs │ │ │ │ ├── pages │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── home.rs │ │ │ │ │ └── hello.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ ├── struct_hello.rs │ │ │ │ │ └── text_input.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── router.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── struct_properties │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ └── mod.rs │ │ │ │ ├── pages │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── home.rs │ │ │ │ │ └── hello.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ ├── text_input.rs │ │ │ │ │ └── struct_hello.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── router.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── use_context_hook │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ └── mod.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ └── text_input.rs │ │ │ ├── main.rs │ │ │ └── main.css │ │ ├── Cargo.toml │ │ └── index.html │ ├── using_yewdux_to_store_form_data │ │ ├── src │ │ │ ├── stores │ │ │ │ ├── mod.rs │ │ │ │ └── auth_store.rs │ │ │ ├── main.rs │ │ │ └── lib.rs │ │ ├── README.md │ │ ├── Cargo.toml │ │ └── index.html │ ├── one_complicated_state │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ └── mod.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ └── text_input.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── setting_up_yew_router │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ └── mod.rs │ │ │ │ ├── pages │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── home.rs │ │ │ │ │ └── hello.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ └── text_input.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── router.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── struct_lifecycle_methods │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ └── mod.rs │ │ │ │ ├── pages │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── home.rs │ │ │ │ │ └── hello.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ └── text_input.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── router.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── struct_messages │ │ ├── src │ │ │ ├── components │ │ │ │ ├── pages │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── home.rs │ │ │ │ │ └── hello.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── molecules │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── struct_counter.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ └── text_input.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── router.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── styling_struct_components │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ └── mod.rs │ │ │ │ ├── pages │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── home.rs │ │ │ │ │ └── hello.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ ├── text_input.rs │ │ │ │ │ └── struct_hello.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── router.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── dynamically_setting_the_api_uri │ │ ├── src │ │ │ ├── api │ │ │ │ ├── base_api_uri.txt │ │ │ │ └── mod.rs │ │ │ ├── main.rs │ │ │ ├── router.rs │ │ │ ├── store.rs │ │ │ └── display.rs │ │ ├── index.html │ │ └── Cargo.toml │ ├── handling_form_submit_events │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ └── mod.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ └── text_input.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── handling_text_field_events │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── custom_form.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ └── text_input.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── programattic_linking_to_pages │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ └── mod.rs │ │ │ │ ├── pages │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── home.rs │ │ │ │ │ └── hello.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ └── text_input.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── router.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── hello_world_in_rust │ │ ├── src │ │ │ └── main.rs │ │ ├── Cargo.lock │ │ └── Cargo.toml │ ├── simplifying_complicated_state_updates │ │ ├── src │ │ │ ├── components │ │ │ │ ├── molecules │ │ │ │ │ └── mod.rs │ │ │ │ ├── mod.rs │ │ │ │ └── atoms │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── custom_button.rs │ │ │ │ │ └── text_input.rs │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── bootstrap_css │ │ ├── src │ │ │ ├── main.rs │ │ │ └── text_form_field.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── inline_styles │ │ ├── src │ │ │ ├── main.rs │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── http_get_requests │ │ ├── src │ │ │ ├── main.rs │ │ │ ├── router.rs │ │ │ ├── store.rs │ │ │ └── display.rs │ │ ├── index.html │ │ └── Cargo.toml │ ├── http_post_requests │ │ ├── src │ │ │ ├── main.rs │ │ │ ├── router.rs │ │ │ ├── store.rs │ │ │ ├── api.rs │ │ │ └── display.rs │ │ ├── index.html │ │ └── Cargo.toml │ ├── persistant_state │ │ ├── src │ │ │ ├── main.rs │ │ │ ├── lib.rs │ │ │ ├── router.rs │ │ │ ├── store.rs │ │ │ └── display.rs │ │ ├── index.html │ │ └── Cargo.toml │ ├── separate_css_file │ │ ├── src │ │ │ ├── main.rs │ │ │ ├── main.css │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── html_in_rust │ │ ├── src │ │ │ ├── main.rs │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── html_loops │ │ ├── src │ │ │ └── main.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── introduction_to_stylist │ │ ├── src │ │ │ ├── main.rs │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── html_conditionals │ │ ├── src │ │ │ └── main.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── logging_to_the_console │ │ ├── src │ │ │ ├── main.rs │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── a_better_hello_world_architecture │ │ ├── src │ │ │ ├── main.rs │ │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── index.html │ └── hello_world_in_yew │ │ ├── src │ │ └── main.rs │ │ ├── Cargo.toml │ │ └── index.html │ ├── solution │ ├── src │ │ ├── api │ │ │ ├── api_base_uri.txt │ │ │ └── api_errors.rs │ │ ├── components │ │ │ ├── organisms │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── molecules │ │ │ │ └── mod.rs │ │ │ └── atoms │ │ │ │ └── mod.rs │ │ ├── main.rs │ │ ├── pages │ │ │ └── mod.rs │ │ └── router.rs │ ├── Dockerfile │ ├── Cargo.toml │ └── index.html │ ├── todo_project │ ├── Dockerfile │ ├── Cargo.toml │ ├── src │ │ └── main.rs │ └── index.html │ └── README.md ├── backend ├── rust │ └── axum │ │ ├── lessons │ │ ├── data │ │ │ ├── src │ │ │ │ ├── utils │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── app_error.rs │ │ │ │ ├── routes │ │ │ │ │ ├── hello_world.rs │ │ │ │ │ └── validate_with_serde.rs │ │ │ │ ├── database │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── prelude.rs │ │ │ │ │ └── users.rs │ │ │ │ ├── main.rs │ │ │ │ └── lib.rs │ │ │ └── Cargo.toml │ │ ├── routing │ │ │ ├── src │ │ │ │ ├── main.rs │ │ │ │ ├── routes │ │ │ │ │ ├── mirror_body_string.rs │ │ │ │ │ ├── hello_world.rs │ │ │ │ │ ├── always_errors.rs │ │ │ │ │ ├── middleware_message.rs │ │ │ │ │ ├── mirror_user_agent.rs │ │ │ │ │ ├── returns_201.rs │ │ │ │ │ ├── path_variables.rs │ │ │ │ │ ├── read_middleware_custom_header.rs │ │ │ │ │ ├── mirror_custom_header.rs │ │ │ │ │ ├── query_params.rs │ │ │ │ │ ├── get_json.rs │ │ │ │ │ ├── mirror_body_json.rs │ │ │ │ │ └── set_middleware_custom_header.rs │ │ │ │ └── lib.rs │ │ │ └── Cargo.toml │ │ └── hello_world │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ └── main.rs │ │ ├── project_solution │ │ ├── src │ │ │ ├── middleware │ │ │ │ └── mod.rs │ │ │ ├── routes │ │ │ │ ├── hello_world.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── users │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── logout.rs │ │ │ │ └── tasks │ │ │ │ │ ├── delete_task.rs │ │ │ │ │ ├── get_one_task.rs │ │ │ │ │ ├── create_task.rs │ │ │ │ │ └── get_all_tasks.rs │ │ │ ├── queries │ │ │ │ └── mod.rs │ │ │ ├── utilities │ │ │ │ ├── token_wrapper.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── hash.rs │ │ │ │ └── app_error.rs │ │ │ ├── database │ │ │ │ ├── mod.rs │ │ │ │ ├── prelude.rs │ │ │ │ └── users.rs │ │ │ ├── app_state.rs │ │ │ ├── lib.rs │ │ │ └── main.rs │ │ └── Cargo.toml │ │ └── Dockerfile └── nodejs │ └── express │ ├── Dockerfile │ ├── knexfile.js │ ├── routes │ ├── index.js │ └── utilities.js │ ├── database │ └── index.js │ ├── package.json │ └── app.js ├── .gitignore ├── docs └── index-dea13a4752a53497_bg.wasm └── LICENSE /integration-tests/frontend-tests/cypress/cypress.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /frontend/js/vue/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/callbacks/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/enum_properties/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/solution/src/api/api_base_uri.txt: -------------------------------------------------------------------------------- 1 | http://localhost:3000/api/v1 -------------------------------------------------------------------------------- /backend/rust/axum/lessons/data/src/utils/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod app_error; 2 | pub mod jwt; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/callbacks/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod main_title; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yewdux/src/stores/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod counter_store; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/yewdux_functional/src/store/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod auth_store; 2 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/middleware/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod require_authentication; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/enum_properties/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod main_title; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/set_timeout/src/api/base_api_uri.txt: -------------------------------------------------------------------------------- 1 | http://localhost:3000/api/v1 -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_state/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/routes/hello_world.rs: -------------------------------------------------------------------------------- 1 | pub async fn hello_world() {} 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/creating_a_form/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/multiple_states/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_effect_hook/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/solution/src/components/organisms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod navbar; 2 | pub mod tasks; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_static_files/src/api/base_api_uri.txt: -------------------------------------------------------------------------------- 1 | http://localhost:3000/api/v1 -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/linking_to_pages/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/passing_properties_into_components/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_components/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_properties/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_context_hook/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_state/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/using_yewdux_to_store_form_data/src/stores/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod auth_store; 2 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/queries/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod task_queries; 2 | pub mod user_queries; 3 | -------------------------------------------------------------------------------- /frontend/js/vue/vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | devServer: { 3 | host: "0.0.0.0" 4 | } 5 | } -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/creating_a_form/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/linking_to_pages/src/components/pages/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod hello; 2 | pub mod home; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/multiple_states/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/one_complicated_state/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yew_router/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_components/src/components/pages/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod hello; 2 | pub mod home; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_lifecycle_methods/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_messages/src/components/pages/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod hello; 2 | pub mod home; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_properties/src/components/pages/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod hello; 2 | pub mod home; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/styling_struct_components/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_context_hook/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_effect_hook/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/dynamically_setting_the_api_uri/src/api/base_api_uri.txt: -------------------------------------------------------------------------------- 1 | http://localhost:3000/api/v1 -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_form_submit_events/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_text_field_events/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/one_complicated_state/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/passing_properties_into_components/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod main_title; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/programattic_linking_to_pages/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yew_router/src/components/pages/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod hello; 2 | pub mod home; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/solution/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | pub mod organisms; 4 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/routes/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod hello_world; 2 | pub mod tasks; 3 | pub mod users; 4 | -------------------------------------------------------------------------------- /frontend/js/vue/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:14 2 | VOLUME /code 3 | WORKDIR /code 4 | EXPOSE 8080 5 | CMD npm run serve 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_form_submit_events/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_text_field_events/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/hello_world_in_rust/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!("Hello, world!"); 3 | } 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_lifecycle_methods/src/components/pages/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod hello; 2 | pub mod home; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/styling_struct_components/src/components/pages/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod hello; 2 | pub mod home; 3 | -------------------------------------------------------------------------------- /integration-tests/frontend-tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "faker": "^5.5.3" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/programattic_linking_to_pages/src/components/pages/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod hello; 2 | pub mod home; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/simplifying_complicated_state_updates/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/utilities/token_wrapper.rs: -------------------------------------------------------------------------------- 1 | #[derive(Clone)] 2 | pub struct TokenWrapper(pub String); 3 | -------------------------------------------------------------------------------- /frontend/js/vue/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/linking_to_pages/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | pub mod pages; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/simplifying_complicated_state_updates/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_components/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | pub mod pages; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_messages/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | pub mod pages; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_messages/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_form; 2 | pub mod struct_counter; 3 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_properties/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | pub mod pages; 4 | -------------------------------------------------------------------------------- /backend/nodejs/express/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:14 2 | EXPOSE 3000 3 | VOLUME /code 4 | WORKDIR /code 5 | CMD npm i && npm run dev 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yew_router/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | pub mod pages; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_lifecycle_methods/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | pub mod pages; 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/node_modules 2 | **/.env 3 | **/integration-tests/**/*.mp4 4 | **/integration-tests/**/*.png 5 | **/target 6 | **/dist 7 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/programattic_linking_to_pages/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | pub mod pages; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/styling_struct_components/src/components/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod atoms; 2 | pub mod molecules; 3 | pub mod pages; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_state/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod text_input; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/solution/src/main.rs: -------------------------------------------------------------------------------- 1 | use solution::App; 2 | 3 | fn main() { 4 | yew::Renderer::::new().render(); 5 | } 6 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/data/src/routes/hello_world.rs: -------------------------------------------------------------------------------- 1 | pub async fn hello_world() -> String { 2 | "Hello world!!!".to_owned() 3 | } 4 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/src/main.rs: -------------------------------------------------------------------------------- 1 | use routing::run; 2 | 3 | #[tokio::main] 4 | async fn main() { 5 | run().await 6 | } 7 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/utilities/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod app_error; 2 | pub mod hash; 3 | pub mod jwt; 4 | pub mod token_wrapper; 5 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/callbacks/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_state/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/solution/src/components/molecules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod account_form; 2 | pub mod error_message; 3 | pub mod task_edit_buttons; 4 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/src/routes/mirror_body_string.rs: -------------------------------------------------------------------------------- 1 | pub async fn mirror_body_string(body: String) -> String { 2 | body 3 | } 4 | -------------------------------------------------------------------------------- /docs/index-dea13a4752a53497_bg.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brooks-builds/full-stack-todo-rust-course/HEAD/docs/index-dea13a4752a53497_bg.wasm -------------------------------------------------------------------------------- /frontend/js/vue/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brooks-builds/full-stack-todo-rust-course/HEAD/frontend/js/vue/public/favicon.ico -------------------------------------------------------------------------------- /frontend/js/vue/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brooks-builds/full-stack-todo-rust-course/HEAD/frontend/js/vue/src/assets/logo.png -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/bootstrap_css/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/creating_a_form/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod text_input; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/inline_styles/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/linking_to_pages/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod text_input; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/multiple_states/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod text_input; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/set_timeout/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_context_hook/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod text_input; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_effect_hook/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod text_input; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/creating_a_form/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/enum_properties/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/http_get_requests/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/http_post_requests/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/linking_to_pages/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/multiple_states/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/one_complicated_state/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod text_input; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/persistant_state/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/separate_css_file/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yew_router/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod text_input; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yewdux/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_components/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_messages/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_properties/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_context_hook/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_effect_hook/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/yewdux_functional/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/src/routes/hello_world.rs: -------------------------------------------------------------------------------- 1 | pub async fn hello_world() -> String { 2 | "Hello World from my own file".to_owned() 3 | } 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_form_submit_events/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod text_input; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_static_files/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_text_field_events/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod text_input; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/html_in_rust/src/main.rs: -------------------------------------------------------------------------------- 1 | use a_better_hello_world_architecture::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/html_loops/src/main.rs: -------------------------------------------------------------------------------- 1 | use a_better_hello_world_architecture::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/introduction_to_stylist/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/one_complicated_state/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/programattic_linking_to_pages/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod text_input; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yew_router/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_lifecycle_methods/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_form_submit_events/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_text_field_events/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/html_conditionals/src/main.rs: -------------------------------------------------------------------------------- 1 | use a_better_hello_world_architecture::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/programattic_linking_to_pages/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/styling_struct_components/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/dynamically_setting_the_api_uri/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/logging_to_the_console/src/main.rs: -------------------------------------------------------------------------------- 1 | use a_better_hello_world_architecture::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/passing_properties_into_components/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/simplifying_complicated_state_updates/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod text_input; 4 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/using_yewdux_to_store_form_data/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/simplifying_complicated_state_updates/src/main.rs: -------------------------------------------------------------------------------- 1 | use introduction_to_yewrs::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_components/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod struct_hello; 4 | pub mod text_input; 5 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_messages/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod struct_hello; 4 | pub mod text_input; 5 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_properties/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod struct_hello; 4 | pub mod text_input; 5 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/data/src/database/mod.rs: -------------------------------------------------------------------------------- 1 | //! SeaORM Entity. Generated by sea-orm-codegen 0.9.2 2 | 3 | pub mod prelude; 4 | 5 | pub mod tasks; 6 | pub mod users; 7 | -------------------------------------------------------------------------------- /frontend/rust/yew/solution/src/pages/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod add_task; 2 | pub mod create_account; 3 | pub mod edit_task; 4 | pub mod home; 5 | pub mod login; 6 | pub mod one_task; 7 | -------------------------------------------------------------------------------- /backend/nodejs/express/knexfile.js: -------------------------------------------------------------------------------- 1 | // Update with your config settings. 2 | 3 | module.exports = { 4 | client: 'postgresql', 5 | connection: process.env.DB_CONNECTION 6 | }; 7 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/database/mod.rs: -------------------------------------------------------------------------------- 1 | //! SeaORM Entity. Generated by sea-orm-codegen 0.9.2 2 | 3 | pub mod prelude; 4 | 5 | pub mod tasks; 6 | pub mod users; 7 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/a_better_hello_world_architecture/src/main.rs: -------------------------------------------------------------------------------- 1 | use a_better_hello_world_architecture::App; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/callbacks/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_lifecycle_methods/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod struct_hello; 4 | pub mod text_input; 5 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/styling_struct_components/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod custom_button; 2 | pub mod main_title; 3 | pub mod struct_hello; 4 | pub mod text_input; 5 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_state/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/creating_a_form/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/enum_properties/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/multiple_states/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_messages/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_effect_hook/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /integration-tests/backend-tests/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:14 2 | VOLUME /code 3 | WORKDIR /code 4 | RUN npm i 5 | ENV API_PORT=3000 6 | ENV API_URI=http://localhost 7 | CMD npm run test:watch -------------------------------------------------------------------------------- /backend/nodejs/express/routes/index.js: -------------------------------------------------------------------------------- 1 | const tasksRouter = require('./tasks') 2 | const usersRouter = require('./users') 3 | 4 | module.exports = { 5 | tasksRouter, 6 | usersRouter 7 | } -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/linking_to_pages/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/separate_css_file/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_components/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_properties/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_context_hook/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /backend/nodejs/express/database/index.js: -------------------------------------------------------------------------------- 1 | const knex = require("knex"); 2 | const configuration = require("../knexfile"); 3 | 4 | const db = knex(configuration); 5 | 6 | module.exports = db; 7 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/one_complicated_state/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yew_router/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_lifecycle_methods/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/styling_struct_components/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/yewdux_functional/README.md: -------------------------------------------------------------------------------- 1 | # Functional Yewdux 2 | 3 | - [x] Install Yewdux 4 | - [x] Create store 5 | - [x] Store form data into store 6 | - [ ] Display form data 7 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/src/routes/always_errors.rs: -------------------------------------------------------------------------------- 1 | use axum::http::StatusCode; 2 | 3 | pub async fn always_errors() -> Result<(), StatusCode> { 4 | Err(StatusCode::IM_A_TEAPOT) 5 | } 6 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/src/routes/middleware_message.rs: -------------------------------------------------------------------------------- 1 | use axum::extract::State; 2 | 3 | pub async fn middleware_message(State(message): State) -> String { 4 | message 5 | } 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_form_submit_events/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_text_field_events/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/programattic_linking_to_pages/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/passing_properties_into_components/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/solution/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust:latest 2 | RUN rustup target add wasm32-unknown-unknown 3 | RUN cargo install trunk 4 | VOLUME /code 5 | WORKDIR /code 6 | EXPOSE 8080 7 | CMD trunk serve 8 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yewdux/src/stores/counter_store.rs: -------------------------------------------------------------------------------- 1 | use yewdux::prelude::*; 2 | 3 | #[derive(Store, Default, PartialEq, Clone)] 4 | pub struct CounterStore { 5 | pub count: u32, 6 | } 7 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/simplifying_complicated_state_updates/src/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: aqua; 3 | } 4 | 5 | * { 6 | font-size: 100px; 7 | } 8 | 9 | p { 10 | color: yellowgreen; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/todo_project/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust:latest 2 | RUN rustup target add wasm32-unknown-unknown 3 | RUN cargo install trunk 4 | VOLUME /code 5 | WORKDIR /code 6 | EXPOSE 8080 7 | CMD trunk serve 8 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_static_files/static/xilbe_cool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brooks-builds/full-stack-todo-rust-course/HEAD/frontend/rust/yew/lessons/handling_static_files/static/xilbe_cool.png -------------------------------------------------------------------------------- /frontend/rust/yew/solution/src/components/atoms/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod bb_button; 2 | pub mod bb_checkbox; 3 | pub mod bb_link; 4 | pub mod bb_select; 5 | pub mod bb_text; 6 | pub mod bb_text_input; 7 | pub mod bb_textarea; 8 | -------------------------------------------------------------------------------- /integration-tests/backend-tests/.env-example: -------------------------------------------------------------------------------- 1 | export API_PORT=3000 2 | export API_URI=http://localhost 3 | export JWT_SECRET=keyboardcat 4 | export DB_CONNECTION=postgres://postgres:keyoarbcat@localhost:5432/postgres 5 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/data/src/database/prelude.rs: -------------------------------------------------------------------------------- 1 | //! SeaORM Entity. Generated by sea-orm-codegen 0.9.2 2 | #![allow(unused_imports)] 3 | pub use super::tasks::Entity as Tasks; 4 | pub use super::users::Entity as Users; 5 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/linking_to_pages/src/components/pages/hello.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[function_component(Hello)] 4 | pub fn hello() -> Html { 5 | html! { 6 |

{"Hello"}

7 | } 8 | } 9 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yew_router/src/components/pages/home.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[function_component(Home)] 4 | pub fn home() -> Html { 5 | html! { 6 |

{"Home"}

7 | } 8 | } 9 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yewdux/README.md: -------------------------------------------------------------------------------- 1 | # Setting up Yewdux 2 | 3 | - [x] Install Yewdux 4 | - [x] Create counter store with default value 5 | - [x] display counter 6 | - [x] Create button to increment count 7 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/database/prelude.rs: -------------------------------------------------------------------------------- 1 | //! SeaORM Entity. Generated by sea-orm-codegen 0.9.2 2 | 3 | #![allow(unused)] 4 | pub use super::tasks::Entity as Tasks; 5 | pub use super::users::Entity as Users; 6 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/a_better_hello_world_architecture/src/lib.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[function_component(App)] 4 | pub fn app() -> Html { 5 | html! { 6 |

{"Hello World!!!"}

7 | } 8 | } 9 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yew_router/src/components/pages/hello.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[function_component(Hello)] 4 | pub fn hello() -> Html { 5 | html! { 6 |

{"Hello"}

7 | } 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/frontend-tests/cypress/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io", 4 | "body": "Fixtures are a great way to mock data for responses to routes" 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/backend-tests/knexfile.js: -------------------------------------------------------------------------------- 1 | // Update with your config settings. 2 | 3 | console.log(process.env.DB_CONNECTION) 4 | 5 | module.exports = { 6 | client: 'postgresql', 7 | connection: process.env.DB_CONNECTION 8 | }; 9 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/hello_world_in_rust/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "hello_world_in_rust" 7 | version = "0.1.0" 8 | -------------------------------------------------------------------------------- /backend/rust/axum/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust:latest 2 | 3 | RUN cargo install --locked cargo-watch 4 | RUN mkdir /code 5 | 6 | COPY project_solution /code 7 | 8 | WORKDIR /code 9 | 10 | EXPOSE 3000 11 | 12 | CMD ["cargo", "watch", "-x", "run"] 13 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/src/routes/mirror_user_agent.rs: -------------------------------------------------------------------------------- 1 | use axum_extra::{headers::UserAgent, TypedHeader}; 2 | 3 | pub async fn mirror_user_agent(TypedHeader(user_agent): TypedHeader) -> String { 4 | user_agent.to_string() 5 | } 6 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/src/routes/returns_201.rs: -------------------------------------------------------------------------------- 1 | use axum::{ 2 | http::StatusCode, 3 | response::{IntoResponse, Response}, 4 | }; 5 | 6 | pub async fn returns_201() -> Response { 7 | (StatusCode::CREATED, ()).into_response() 8 | } 9 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/using_yewdux_to_store_form_data/README.md: -------------------------------------------------------------------------------- 1 | # Using Yewdux to Store Form Data 2 | 3 | - [x] Install Yewdux 4 | - [x] Create the store 5 | - [x] Create Form 6 | - [x] Add form data to store when changed 7 | - [x] Display form data 8 | -------------------------------------------------------------------------------- /frontend/rust/yew/todo_project/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "todo_project" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" -------------------------------------------------------------------------------- /frontend/rust/yew/todo_project/src/main.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | 7 | #[function_component(App)] 8 | fn app() -> Html { 9 | html! { 10 |

{"Hello World"}

11 | } 12 | } 13 | -------------------------------------------------------------------------------- /integration-tests/frontend-tests/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:16 2 | RUN apt-get update && apt-get install -y xvfb libnss3 libatk1.0-0 libatk-bridge2.0-0 libgtk-3-0 libgbm1 libasound2 3 | RUN npm i -g cypress 4 | VOLUME /code 5 | WORKDIR /code 6 | CMD cypress run --no-exit -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/hello_world_in_rust/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hello_world_in_rust" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/hello_world_in_yew/src/main.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | fn main() { 4 | yew::start_app::(); 5 | } 6 | 7 | #[function_component(App)] 8 | fn app() -> Html { 9 | html! { 10 |

{"Hello World"}

11 | } 12 | } 13 | -------------------------------------------------------------------------------- /frontend/rust/yew/solution/src/api/api_errors.rs: -------------------------------------------------------------------------------- 1 | use thiserror::Error; 2 | 3 | #[derive(Debug, Error)] 4 | pub enum ApiError { 5 | #[error("Expired or missing auth token")] 6 | NotAuthenticated, 7 | #[error("Unknown Network error")] 8 | Unknown, 9 | } 10 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/data/src/main.rs: -------------------------------------------------------------------------------- 1 | use data::run; 2 | use dotenvy::dotenv; 3 | use dotenvy_macro::dotenv; 4 | 5 | #[tokio::main] 6 | async fn main() { 7 | dotenv().ok(); 8 | let database_uri = dotenv!("DATABASE_URL"); 9 | run(database_uri).await; 10 | } 11 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/hello_world_in_yew/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hello_world_in_yew" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/src/routes/path_variables.rs: -------------------------------------------------------------------------------- 1 | use axum::extract::Path; 2 | 3 | pub async fn path_variables(Path(id): Path) -> String { 4 | id.to_string() 5 | } 6 | 7 | pub async fn hard_coded_path() -> String { 8 | "You got 15!".to_owned() 9 | } 10 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/yewdux_functional/src/store/auth_store.rs: -------------------------------------------------------------------------------- 1 | use yewdux::prelude::*; 2 | 3 | #[derive(Store, Default, PartialEq, Clone)] 4 | pub struct AuthStore { 5 | pub username: Option, 6 | pub password: Option, 7 | pub is_authenticated: bool, 8 | } 9 | -------------------------------------------------------------------------------- /frontend/js/vue/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import store from './store' 5 | 6 | Vue.config.productionTip = false 7 | 8 | new Vue({ 9 | router, 10 | store, 11 | render: h => h(App) 12 | }).$mount('#app') 13 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/bootstrap_css/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/src/routes/read_middleware_custom_header.rs: -------------------------------------------------------------------------------- 1 | use axum::Extension; 2 | 3 | #[derive(Clone)] 4 | pub struct HeaderMessage(pub String); 5 | 6 | pub async fn read_middleware_custom_header(Extension(message): Extension) -> String { 7 | message.0 8 | } 9 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/using_yewdux_to_store_form_data/src/stores/auth_store.rs: -------------------------------------------------------------------------------- 1 | use yewdux::prelude::*; 2 | 3 | #[derive(Store, Default, PartialEq, Clone)] 4 | pub struct AuthStore { 5 | pub username: Option, 6 | pub password: Option, 7 | pub is_authenticated: bool, 8 | } 9 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/a_better_hello_world_architecture/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "a_better_hello_world_architecture" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/src/routes/mirror_custom_header.rs: -------------------------------------------------------------------------------- 1 | use axum::http::HeaderMap; 2 | 3 | pub async fn mirror_custom_header(headers: HeaderMap) -> String { 4 | let message_value = headers.get("User-Agent").unwrap(); 5 | let message = message_value.to_str().unwrap().to_owned(); 6 | message 7 | } 8 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/app_state.rs: -------------------------------------------------------------------------------- 1 | use axum::extract::FromRef; 2 | use sea_orm::DatabaseConnection; 3 | 4 | use crate::utilities::token_wrapper::TokenWrapper; 5 | 6 | #[derive(Clone, FromRef)] 7 | pub struct AppState { 8 | pub db: DatabaseConnection, 9 | pub jwt_secret: TokenWrapper, 10 | } 11 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yewdux/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | gloo = "0.8.0" 11 | yewdux = "0.8.2" 12 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/inline_styles/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/enum_properties/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/separate_css_file/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/introduction_to_stylist/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} -------------------------------------------------------------------------------- /backend/rust/axum/lessons/hello_world/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hello_world" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | axum = "0.7.5" 10 | tokio = { version = "1.21.2", features = ["macros", "rt-multi-thread"] } 11 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/callbacks/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" -------------------------------------------------------------------------------- /frontend/rust/yew/todo_project/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /frontend/js/vue/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/passing_properties_into_components/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/creating_a_form/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/html_in_rust/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "a_better_hello_world_architecture" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | gloo = "0.6.1" 11 | serde = "1.0.136" 12 | serde_json = "1.0.79" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/html_loops/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "a_better_hello_world_architecture" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | gloo = "0.6.1" 11 | serde = "1.0.136" 12 | serde_json = "1.0.79" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/html_conditionals/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "a_better_hello_world_architecture" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | gloo = "0.6.1" 11 | serde = "1.0.136" 12 | serde_json = "1.0.79" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_state/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | } 7 | 8 | #[function_component(CustomButton)] 9 | pub fn custom_button(props: &Props) -> Html { 10 | html! { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/creating_a_form/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | } 7 | 8 | #[function_component(CustomButton)] 9 | pub fn custom_button(props: &Props) -> Html { 10 | html! { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/linking_to_pages/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | } 7 | 8 | #[function_component(CustomButton)] 9 | pub fn custom_button(props: &Props) -> Html { 10 | html! { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/logging_to_the_console/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "a_better_hello_world_architecture" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | gloo = "0.6.1" 11 | serde = "1.0.136" 12 | serde_json = "1.0.79" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/passing_properties_into_components/src/components/atoms/main_title.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub title: String, 6 | } 7 | 8 | #[function_component(MainTitle)] 9 | pub fn main_title(props: &Props) -> Html { 10 | html! { 11 |

{&props.title}

12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_components/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | } 7 | 8 | #[function_component(CustomButton)] 9 | pub fn custom_button(props: &Props) -> Html { 10 | html! { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_messages/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | } 7 | 8 | #[function_component(CustomButton)] 9 | pub fn custom_button(props: &Props) -> Html { 10 | html! { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_properties/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | } 7 | 8 | #[function_component(CustomButton)] 9 | pub fn custom_button(props: &Props) -> Html { 10 | html! { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_context_hook/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | } 7 | 8 | #[function_component(CustomButton)] 9 | pub fn custom_button(props: &Props) -> Html { 10 | html! { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_effect_hook/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | } 7 | 8 | #[function_component(CustomButton)] 9 | pub fn custom_button(props: &Props) -> Html { 10 | html! { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/data/src/routes/validate_with_serde.rs: -------------------------------------------------------------------------------- 1 | use axum::Json; 2 | use serde::Deserialize; 3 | 4 | #[derive(Deserialize, Debug)] 5 | #[allow(dead_code)] 6 | pub struct RequestUser { 7 | pub username: Option, 8 | pub password: String, 9 | } 10 | 11 | pub async fn validate_with_serde(Json(user): Json) { 12 | dbg!(user); 13 | } 14 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod routes; 2 | 3 | use routes::create_routes; 4 | use tokio::net::TcpListener; 5 | 6 | pub async fn run() { 7 | let app = create_routes(); 8 | let listener = TcpListener::bind(&"0.0.0.0:3000").await.unwrap(); 9 | 10 | axum::serve(listener, app.into_make_service()) 11 | .await 12 | .unwrap(); 13 | } 14 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/src/routes/query_params.rs: -------------------------------------------------------------------------------- 1 | use axum::{extract::Query, Json}; 2 | use serde::{Deserialize, Serialize}; 3 | 4 | #[derive(Serialize, Deserialize)] 5 | pub struct QueryParams { 6 | message: String, 7 | id: i32, 8 | } 9 | 10 | pub async fn query_params(Query(query): Query) -> Json { 11 | Json(query) 12 | } 13 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/creating_a_form/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub name: String, 6 | } 7 | 8 | #[function_component(TextInput)] 9 | pub fn text_input(props: &Props) -> Html { 10 | html! { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yew_router/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | } 7 | 8 | #[function_component(CustomButton)] 9 | pub fn custom_button(props: &Props) -> Html { 10 | html! { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_form_submit_events/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | } 7 | 8 | #[function_component(CustomButton)] 9 | pub fn custom_button(props: &Props) -> Html { 10 | html! { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_text_field_events/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | } 7 | 8 | #[function_component(CustomButton)] 9 | pub fn custom_button(props: &Props) -> Html { 10 | html! { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_lifecycle_methods/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | } 7 | 8 | #[function_component(CustomButton)] 9 | pub fn custom_button(props: &Props) -> Html { 10 | html! { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/styling_struct_components/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | } 7 | 8 | #[function_component(CustomButton)] 9 | pub fn custom_button(props: &Props) -> Html { 10 | html! { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /integration-tests/frontend-tests/cypress.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | e2e: { 3 | // We've imported your old cypress plugins here. 4 | // You may want to clean this up later by importing these. 5 | setupNodeEvents(on, config) { 6 | return require('./cypress/plugins/index.js')(on, config) 7 | }, 8 | baseUrl: 'http://localhost:8080', 9 | }, 10 | } 11 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/programattic_linking_to_pages/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | } 7 | 8 | #[function_component(CustomButton)] 9 | pub fn custom_button(props: &Props) -> Html { 10 | html! { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/persistant_state/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod display; 2 | mod login; 3 | mod store; 4 | 5 | use display::Display; 6 | use login::Login; 7 | use yew::prelude::*; 8 | 9 | #[function_component(App)] 10 | pub fn view() -> Html { 11 | html! { 12 |
13 |

{"App"}

14 | 15 | 16 |
17 | } 18 | } 19 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/enum_properties/src/lib.rs: -------------------------------------------------------------------------------- 1 | use stylist::yew::styled_component; 2 | use yew::prelude::*; 3 | 4 | mod components; 5 | 6 | use components::atoms::main_title::{Color, MainTitle}; 7 | 8 | #[styled_component(App)] 9 | pub fn app() -> Html { 10 | html! { 11 |
12 | 13 |
14 | } 15 | } 16 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/linking_to_pages/src/components/pages/home.rs: -------------------------------------------------------------------------------- 1 | use crate::router::Route; 2 | use yew::prelude::*; 3 | use yew_router::prelude::*; 4 | 5 | #[function_component(Home)] 6 | pub fn home() -> Html { 7 | html! { 8 |
9 |

{"Home"}

10 |
11 | to={Route::Hello}>{ "To Hello" }> 12 |
13 |
14 | } 15 | } 16 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_components/src/components/pages/home.rs: -------------------------------------------------------------------------------- 1 | use crate::router::Route; 2 | use yew::prelude::*; 3 | use yew_router::prelude::*; 4 | 5 | #[function_component(Home)] 6 | pub fn home() -> Html { 7 | html! { 8 |
9 |

{"Home"}

10 |
11 | to={Route::Hello}>{ "To Hello" }> 12 |
13 |
14 | } 15 | } 16 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_messages/src/components/pages/home.rs: -------------------------------------------------------------------------------- 1 | use crate::router::Route; 2 | use yew::prelude::*; 3 | use yew_router::prelude::*; 4 | 5 | #[function_component(Home)] 6 | pub fn home() -> Html { 7 | html! { 8 |
9 |

{"Home"}

10 |
11 | to={Route::Hello}>{ "To Hello" }> 12 |
13 |
14 | } 15 | } 16 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_properties/src/components/pages/home.rs: -------------------------------------------------------------------------------- 1 | use crate::router::Route; 2 | use yew::prelude::*; 3 | use yew_router::prelude::*; 4 | 5 | #[function_component(Home)] 6 | pub fn home() -> Html { 7 | html! { 8 |
9 |

{"Home"}

10 |
11 | to={Route::Hello}>{ "To Hello" }> 12 |
13 |
14 | } 15 | } 16 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/yewdux_functional/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | gloo = "0.8.0" 11 | wasm-bindgen = "0.2.79" 12 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } 13 | yewdux = "0.8.2" 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/set_timeout/src/router.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | use yew_router::prelude::*; 3 | use yewdux::prelude::*; 4 | 5 | use super::login::Counter; 6 | 7 | #[derive(Clone, PartialEq, Routable)] 8 | pub enum Route { 9 | #[at("/")] 10 | Counter, 11 | } 12 | 13 | pub fn switch(route: &Route) -> Html { 14 | match route { 15 | Route::Counter => html! { />}, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_lifecycle_methods/src/components/pages/home.rs: -------------------------------------------------------------------------------- 1 | use crate::router::Route; 2 | use yew::prelude::*; 3 | use yew_router::prelude::*; 4 | 5 | #[function_component(Home)] 6 | pub fn home() -> Html { 7 | html! { 8 |
9 |

{"Home"}

10 |
11 | to={Route::Hello}>{ "To Hello" }> 12 |
13 |
14 | } 15 | } 16 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/http_get_requests/src/router.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | use yew_router::prelude::*; 3 | use yewdux::prelude::*; 4 | 5 | use super::login::Counter; 6 | 7 | #[derive(Clone, PartialEq, Routable)] 8 | pub enum Route { 9 | #[at("/")] 10 | Counter, 11 | } 12 | 13 | pub fn switch(route: &Route) -> Html { 14 | match route { 15 | Route::Counter => html! { />}, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/persistant_state/src/router.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | use yew_router::prelude::*; 3 | use yewdux::prelude::*; 4 | 5 | use super::login::Counter; 6 | 7 | #[derive(Clone, PartialEq, Routable)] 8 | pub enum Route { 9 | #[at("/")] 10 | Counter, 11 | } 12 | 13 | pub fn switch(route: &Route) -> Html { 14 | match route { 15 | Route::Counter => html! { />}, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/programattic_linking_to_pages/src/components/pages/home.rs: -------------------------------------------------------------------------------- 1 | use crate::router::Route; 2 | use yew::prelude::*; 3 | use yew_router::prelude::*; 4 | 5 | #[function_component(Home)] 6 | pub fn home() -> Html { 7 | html! { 8 |
9 |

{"Home"}

10 |
11 | to={Route::Hello}>{ "To Hello" }> 12 |
13 |
14 | } 15 | } 16 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/styling_struct_components/src/components/pages/home.rs: -------------------------------------------------------------------------------- 1 | use crate::router::Route; 2 | use yew::prelude::*; 3 | use yew_router::prelude::*; 4 | 5 | #[function_component(Home)] 6 | pub fn home() -> Html { 7 | html! { 8 |
9 |

{"Home"}

10 |
11 | to={Route::Hello}>{ "To Hello" }> 12 |
13 |
14 | } 15 | } 16 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/yewdux_functional/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod display_auth; 2 | mod login_form; 3 | mod store; 4 | 5 | use display_auth::DisplayAuth; 6 | use login_form::LoginForm; 7 | use yew::prelude::*; 8 | 9 | #[function_component(App)] 10 | pub fn view() -> Html { 11 | html! { 12 |
13 |

{"App"}

14 | 15 | 16 |
17 | } 18 | } 19 | -------------------------------------------------------------------------------- /frontend/js/vue/README.md: -------------------------------------------------------------------------------- 1 | # code 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Lints and fixes files 19 | ``` 20 | npm run lint 21 | ``` 22 | 23 | ### Customize configuration 24 | See [Configuration Reference](https://cli.vuejs.org/config/). 25 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_static_files/src/router.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | use yew_router::prelude::*; 3 | use yewdux::prelude::*; 4 | 5 | use super::login::Counter; 6 | 7 | #[derive(Clone, PartialEq, Routable)] 8 | pub enum Route { 9 | #[at("/")] 10 | Counter, 11 | } 12 | 13 | pub fn switch(route: &Route) -> Html { 14 | match route { 15 | Route::Counter => html! { />}, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/http_post_requests/src/router.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | use yew_router::prelude::*; 3 | use yewdux::prelude::*; 4 | 5 | use super::login::Counter; 6 | 7 | #[derive(Clone, PartialEq, Routable)] 8 | pub enum Route { 9 | #[at("/")] 10 | Counter, 11 | } 12 | 13 | pub fn switch(route: &Route) -> Html { 14 | match route { 15 | Route::Counter => html! { />}, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/using_yewdux_to_store_form_data/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | gloo = "0.8.0" 11 | wasm-bindgen = "0.2.83" 12 | web-sys = { version = "0.3.60", features = ["HtmlInputElement"] } 13 | yewdux = "0.8.2" 14 | -------------------------------------------------------------------------------- /frontend/js/vue/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | 'plugin:vue/essential', 8 | 'eslint:recommended' 9 | ], 10 | parserOptions: { 11 | parser: 'babel-eslint' 12 | }, 13 | rules: { 14 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 15 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_state/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/callbacks/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/creating_a_form/src/components/molecules/custom_form.rs: -------------------------------------------------------------------------------- 1 | use crate::components::atoms::custom_button::CustomButton; 2 | use crate::components::atoms::text_input::TextInput; 3 | use yew::prelude::*; 4 | 5 | #[function_component(CustomForm)] 6 | pub fn custom_form() -> Html { 7 | html! { 8 |
9 | 10 | 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/dynamically_setting_the_api_uri/src/router.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | use yew_router::prelude::*; 3 | use yewdux::prelude::*; 4 | 5 | use super::login::Counter; 6 | 7 | #[derive(Clone, PartialEq, Routable)] 8 | pub enum Route { 9 | #[at("/")] 10 | Counter, 11 | } 12 | 13 | pub fn switch(route: &Route) -> Html { 14 | match route { 15 | Route::Counter => html! { />}, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/inline_styles/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/creating_a_form/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/enum_properties/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/multiple_states/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/separate_css_file/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_context_hook/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_effect_hook/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_text_field_events/src/components/molecules/custom_form.rs: -------------------------------------------------------------------------------- 1 | use crate::components::atoms::custom_button::CustomButton; 2 | use crate::components::atoms::text_input::TextInput; 3 | use yew::prelude::*; 4 | 5 | #[function_component(CustomForm)] 6 | pub fn custom_form() -> Html { 7 | html! { 8 |
9 | 10 | 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/introduction_to_stylist/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/one_complicated_state/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/src/routes/get_json.rs: -------------------------------------------------------------------------------- 1 | use axum::Json; 2 | use serde::Serialize; 3 | 4 | #[derive(Serialize)] 5 | pub struct Data { 6 | message: String, 7 | count: i32, 8 | username: String, 9 | } 10 | 11 | pub async fn get_json() -> Json { 12 | let data = Data { 13 | message: "I'm in data!".to_owned(), 14 | count: 4857, 15 | username: "brookzerker".to_owned(), 16 | }; 17 | 18 | Json(data) 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_form_submit_events/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_text_field_events/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_text_field_events/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/html_in_rust/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/html_loops/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/passing_properties_into_components/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/set_timeout/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/simplifying_complicated_state_updates/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_state/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/hello_world_in_yew/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Hello world in yew 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/html_conditionals/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/http_get_requests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/http_post_requests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/linking_to_pages/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } 14 | yew-router = "0.16.0" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/linking_to_pages/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/multiple_states/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/persistant_state/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/separate_css_file/src/lib.rs: -------------------------------------------------------------------------------- 1 | use stylist::{style, yew::styled_component, Style}; 2 | use yew::prelude::*; 3 | 4 | const STYLE_FILE: &str = include_str!("main.css"); 5 | 6 | #[styled_component(App)] 7 | pub fn app() -> Html { 8 | let stylesheet = Style::new(STYLE_FILE).unwrap(); 9 | html! { 10 |
11 |

{"Hello World!!!"}

12 |

{"more text"}

13 |
14 | } 15 | } 16 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yewdux/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_components/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } 14 | yew-router = "0.16.0" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_components/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_messages/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } 14 | yew-router = "0.16.0" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_messages/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_properties/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } 14 | yew-router = "0.16.0" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_properties/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_context_hook/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_effect_hook/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/yewdux_functional/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/logging_to_the_console/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/one_complicated_state/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yew_router/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } 14 | yew-router = "0.16.0" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yew_router/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /backend/nodejs/express/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "bcrypt": "^5.0.1", 4 | "body-parser": "^1.19.1", 5 | "cors": "^2.8.5", 6 | "dotenv": "^10.0.0", 7 | "express": "^4.17.2", 8 | "jsonwebtoken": "^8.5.1", 9 | "knex": "^0.95.15", 10 | "morgan": "^1.10.0", 11 | "pg": "^8.7.1" 12 | }, 13 | "scripts": { 14 | "start": "node app", 15 | "dev": "nodemon app" 16 | }, 17 | "devDependencies": { 18 | "nodemon": "^2.0.15" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/hello_world/src/main.rs: -------------------------------------------------------------------------------- 1 | use axum::{routing::get, Router}; 2 | use tokio::net::TcpListener; 3 | 4 | #[tokio::main] 5 | async fn main() { 6 | let app = Router::new().route("/", get(hello_world)); 7 | let listener = TcpListener::bind(&"0.0.0.0:3000").await.unwrap(); 8 | 9 | axum::serve(listener, app.into_make_service()) 10 | .await 11 | .unwrap() 12 | } 13 | 14 | async fn hello_world() -> String { 15 | "Hello world!".to_owned() 16 | } 17 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_form_submit_events/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_lifecycle_methods/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } 14 | yew-router = "0.16.0" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_lifecycle_methods/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/styling_struct_components/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } 14 | yew-router = "0.16.0" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/styling_struct_components/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/a_better_hello_world_architecture/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/dynamically_setting_the_api_uri/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/programattic_linking_to_pages/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } 14 | yew-router = "0.16.0" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/programattic_linking_to_pages/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/set_timeout/src/store.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | use yewdux::prelude::*; 3 | 4 | #[derive(Clone, Default, Serialize, Deserialize)] 5 | pub struct YewduxStore { 6 | pub username: String, 7 | pub password: String, 8 | pub token: String, 9 | } 10 | 11 | impl Persistent for YewduxStore { 12 | fn key() -> &'static str { 13 | "IntroductionToYew.rs" 14 | } 15 | 16 | fn area() -> Area { 17 | Area::Local 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/using_yewdux_to_store_form_data/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /integration-tests/backend-tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "axios": "^0.24.0", 4 | "dotenv": "^10.0.0", 5 | "jest": "^27.4.7", 6 | "jsonwebtoken": "^8.5.1", 7 | "knex": "^1.0.1", 8 | "pg": "^8.7.1" 9 | }, 10 | "scripts": { 11 | "test": "jest -b", 12 | "pretest:watch": "npm i", 13 | "test:watch": "jest --watchAll" 14 | }, 15 | "dependencies": { 16 | "bcrypt": "^5.0.1" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/http_get_requests/src/store.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | use yewdux::prelude::*; 3 | 4 | #[derive(Clone, Default, Serialize, Deserialize)] 5 | pub struct YewduxStore { 6 | pub username: String, 7 | pub password: String, 8 | pub token: String, 9 | } 10 | 11 | impl Persistent for YewduxStore { 12 | fn key() -> &'static str { 13 | "IntroductionToYew.rs" 14 | } 15 | 16 | fn area() -> Area { 17 | Area::Local 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/http_post_requests/src/store.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | use yewdux::prelude::*; 3 | 4 | #[derive(Clone, Default, Serialize, Deserialize)] 5 | pub struct YewduxStore { 6 | pub username: String, 7 | pub password: String, 8 | pub token: String, 9 | } 10 | 11 | impl Persistent for YewduxStore { 12 | fn key() -> &'static str { 13 | "IntroductionToYew.rs" 14 | } 15 | 16 | fn area() -> Area { 17 | Area::Local 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/persistant_state/src/store.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | use yewdux::prelude::*; 3 | 4 | #[derive(Clone, Default, Serialize, Deserialize)] 5 | pub struct YewduxStore { 6 | pub username: String, 7 | pub password: String, 8 | pub token: String, 9 | } 10 | 11 | impl Persistent for YewduxStore { 12 | fn key() -> &'static str { 13 | "IntroductionToYew.rs" 14 | } 15 | 16 | fn area() -> Area { 17 | Area::Local 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/simplifying_complicated_state_updates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_static_files/src/store.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | use yewdux::prelude::*; 3 | 4 | #[derive(Clone, Default, Serialize, Deserialize)] 5 | pub struct YewduxStore { 6 | pub username: String, 7 | pub password: String, 8 | pub token: String, 9 | } 10 | 11 | impl Persistent for YewduxStore { 12 | fn key() -> &'static str { 13 | "IntroductionToYew.rs" 14 | } 15 | 16 | fn area() -> Area { 17 | Area::Local 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/data/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod database; 2 | mod routes; 3 | mod utils; 4 | 5 | use sea_orm::Database; 6 | use tokio::net::TcpListener; 7 | 8 | pub async fn run(database_uri: &str) { 9 | let database = Database::connect(database_uri).await.unwrap(); 10 | let app = routes::create_routes(database).await; 11 | let listener = TcpListener::bind(&"0.0.0.0:3000").await.unwrap(); 12 | 13 | axum::serve(listener, app.into_make_service()) 14 | .await 15 | .unwrap(); 16 | } 17 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/dynamically_setting_the_api_uri/src/store.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | use yewdux::prelude::*; 3 | 4 | #[derive(Clone, Default, Serialize, Deserialize)] 5 | pub struct YewduxStore { 6 | pub username: String, 7 | pub password: String, 8 | pub token: String, 9 | } 10 | 11 | impl Persistent for YewduxStore { 12 | fn key() -> &'static str { 13 | "IntroductionToYew.rs" 14 | } 15 | 16 | fn area() -> Area { 17 | Area::Local 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/lib.rs: -------------------------------------------------------------------------------- 1 | use app_state::AppState; 2 | use router::create_router; 3 | use tokio::net::TcpListener; 4 | 5 | pub mod app_state; 6 | mod database; 7 | mod middleware; 8 | mod queries; 9 | mod router; 10 | mod routes; 11 | pub mod utilities; 12 | 13 | pub async fn run(app_state: AppState) { 14 | let app = create_router(app_state); 15 | let address = TcpListener::bind("0.0.0.0:4000").await.unwrap(); 16 | 17 | axum::serve(address, app.into_make_service()).await.unwrap(); 18 | } 19 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/callbacks/src/lib.rs: -------------------------------------------------------------------------------- 1 | use gloo::console::log; 2 | use stylist::yew::styled_component; 3 | use yew::prelude::*; 4 | 5 | mod components; 6 | 7 | use components::atoms::main_title::{Color, MainTitle}; 8 | 9 | #[styled_component(App)] 10 | pub fn app() -> Html { 11 | let main_title_load = Callback::from(|message: String| log!(message)); 12 | html! { 13 |
14 | 15 |
16 | } 17 | } 18 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/linking_to_pages/src/router.rs: -------------------------------------------------------------------------------- 1 | use crate::components::pages::hello::Hello; 2 | use crate::components::pages::home::Home; 3 | use yew::prelude::*; 4 | use yew_router::prelude::*; 5 | 6 | #[derive(Debug, Clone, PartialEq, Routable)] 7 | pub enum Route { 8 | #[at("/")] 9 | Home, 10 | #[at("/hello")] 11 | Hello, 12 | } 13 | 14 | pub fn switch(route: &Route) -> Html { 15 | match route { 16 | Route::Home => html! { }, 17 | Route::Hello => html! { }, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_components/src/router.rs: -------------------------------------------------------------------------------- 1 | use crate::components::pages::hello::Hello; 2 | use crate::components::pages::home::Home; 3 | use yew::prelude::*; 4 | use yew_router::prelude::*; 5 | 6 | #[derive(Debug, Clone, PartialEq, Routable)] 7 | pub enum Route { 8 | #[at("/")] 9 | Home, 10 | #[at("/hello")] 11 | Hello, 12 | } 13 | 14 | pub fn switch(route: &Route) -> Html { 15 | match route { 16 | Route::Home => html! { }, 17 | Route::Hello => html! { }, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_messages/src/router.rs: -------------------------------------------------------------------------------- 1 | use crate::components::pages::hello::Hello; 2 | use crate::components::pages::home::Home; 3 | use yew::prelude::*; 4 | use yew_router::prelude::*; 5 | 6 | #[derive(Debug, Clone, PartialEq, Routable)] 7 | pub enum Route { 8 | #[at("/")] 9 | Home, 10 | #[at("/hello")] 11 | Hello, 12 | } 13 | 14 | pub fn switch(route: &Route) -> Html { 15 | match route { 16 | Route::Home => html! { }, 17 | Route::Hello => html! { }, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_properties/src/router.rs: -------------------------------------------------------------------------------- 1 | use crate::components::pages::hello::Hello; 2 | use crate::components::pages::home::Home; 3 | use yew::prelude::*; 4 | use yew_router::prelude::*; 5 | 6 | #[derive(Debug, Clone, PartialEq, Routable)] 7 | pub enum Route { 8 | #[at("/")] 9 | Home, 10 | #[at("/hello")] 11 | Hello, 12 | } 13 | 14 | pub fn switch(route: &Route) -> Html { 15 | match route { 16 | Route::Home => html! { }, 17 | Route::Hello => html! { }, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_static_files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yew_router/src/router.rs: -------------------------------------------------------------------------------- 1 | use crate::components::pages::hello::Hello; 2 | use crate::components::pages::home::Home; 3 | use yew::prelude::*; 4 | use yew_router::prelude::*; 5 | 6 | #[derive(Debug, Clone, PartialEq, Routable)] 7 | pub enum Route { 8 | #[at("/")] 9 | Home, 10 | #[at("/hello")] 11 | Hello, 12 | } 13 | 14 | pub fn switch(route: &Route) -> Html { 15 | match route { 16 | Route::Home => html! { }, 17 | Route::Hello => html! { }, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_lifecycle_methods/src/router.rs: -------------------------------------------------------------------------------- 1 | use crate::components::pages::hello::Hello; 2 | use crate::components::pages::home::Home; 3 | use yew::prelude::*; 4 | use yew_router::prelude::*; 5 | 6 | #[derive(Debug, Clone, PartialEq, Routable)] 7 | pub enum Route { 8 | #[at("/")] 9 | Home, 10 | #[at("/hello")] 11 | Hello, 12 | } 13 | 14 | pub fn switch(route: &Route) -> Html { 15 | match route { 16 | Route::Home => html! { }, 17 | Route::Hello => html! { }, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/styling_struct_components/src/router.rs: -------------------------------------------------------------------------------- 1 | use crate::components::pages::hello::Hello; 2 | use crate::components::pages::home::Home; 3 | use yew::prelude::*; 4 | use yew_router::prelude::*; 5 | 6 | #[derive(Debug, Clone, PartialEq, Routable)] 7 | pub enum Route { 8 | #[at("/")] 9 | Home, 10 | #[at("/hello")] 11 | Hello, 12 | } 13 | 14 | pub fn switch(route: &Route) -> Html { 15 | match route { 16 | Route::Home => html! { }, 17 | Route::Hello => html! { }, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/js/vue/src/components/FormTextArea.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 19 | 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/programattic_linking_to_pages/src/router.rs: -------------------------------------------------------------------------------- 1 | use crate::components::pages::hello::Hello; 2 | use crate::components::pages::home::Home; 3 | use yew::prelude::*; 4 | use yew_router::prelude::*; 5 | 6 | #[derive(Debug, Clone, PartialEq, Routable)] 7 | pub enum Route { 8 | #[at("/")] 9 | Home, 10 | #[at("/hello")] 11 | Hello, 12 | } 13 | 14 | pub fn switch(route: &Route) -> Html { 15 | match route { 16 | Route::Home => html! { }, 17 | Route::Hello => html! { }, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/persistant_state/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } 14 | yew-router = "0.16.0" 15 | yewdux = "0.7.0" 16 | yewdux-functional = "0.1.0" 17 | serde = "1.0.136" -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "routing" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | axum = { version = "0.7.5", features = ["macros"] } 10 | serde = { version = "1.0.147", features = ["derive"] } 11 | tokio = { version = "1.21.2", features = ["macros", "rt-multi-thread"] } 12 | tower-http = { version = "0.5.2", features = ["cors"] } 13 | axum-extra = { version = "0.9.3", features = ["typed-header"] } 14 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/routes/users/mod.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | pub mod create_user; 4 | pub mod login; 5 | pub mod logout; 6 | 7 | #[derive(Serialize, Deserialize)] 8 | pub struct ResponseDataUser { 9 | data: ResponseUser, 10 | } 11 | 12 | #[derive(Serialize, Deserialize)] 13 | pub struct ResponseUser { 14 | id: i32, 15 | username: String, 16 | token: String, 17 | } 18 | 19 | #[derive(Serialize, Deserialize)] 20 | pub struct RequestCreateUser { 21 | username: String, 22 | password: String, 23 | } 24 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/inline_styles/src/lib.rs: -------------------------------------------------------------------------------- 1 | use stylist::{style, yew::styled_component}; 2 | use yew::prelude::*; 3 | 4 | #[styled_component(App)] 5 | pub fn app() -> Html { 6 | let stylesheet = style!( 7 | r#" 8 | h1 { 9 | color: orange; 10 | } 11 | "# 12 | ) 13 | .unwrap(); 14 | html! { 15 |
16 |

{"Hello World!!!"}

17 |

{"more text"}

18 |
19 | } 20 | } 21 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_messages/src/components/pages/hello.rs: -------------------------------------------------------------------------------- 1 | use gloo::console::log; 2 | use yew::prelude::*; 3 | use yew_router::{history, prelude::*}; 4 | 5 | use crate::router::Route; 6 | 7 | #[function_component(Hello)] 8 | pub fn hello() -> Html { 9 | let history = use_history().unwrap(); 10 | let onclick = Callback::from(move |_| { 11 | history.push(Route::Home); 12 | }); 13 | 14 | html! { 15 |
16 |

{"Hello"}

17 | 18 |
19 | } 20 | } 21 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/multiple_states/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | pub onclick: Callback<()>, 7 | } 8 | 9 | #[function_component(CustomButton)] 10 | pub fn custom_button(props: &Props) -> Html { 11 | let onclick = props.onclick.clone(); 12 | let button_onclick = Callback::from(move |_| { 13 | onclick.emit(()); 14 | }); 15 | html! { 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_components/src/components/pages/hello.rs: -------------------------------------------------------------------------------- 1 | use gloo::console::log; 2 | use yew::prelude::*; 3 | use yew_router::{history, prelude::*}; 4 | 5 | use crate::router::Route; 6 | 7 | #[function_component(Hello)] 8 | pub fn hello() -> Html { 9 | let history = use_history().unwrap(); 10 | let onclick = Callback::from(move |_| { 11 | history.push(Route::Home); 12 | }); 13 | 14 | html! { 15 |
16 |

{"Hello"}

17 | 18 |
19 | } 20 | } 21 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_properties/src/components/pages/hello.rs: -------------------------------------------------------------------------------- 1 | use gloo::console::log; 2 | use yew::prelude::*; 3 | use yew_router::{history, prelude::*}; 4 | 5 | use crate::router::Route; 6 | 7 | #[function_component(Hello)] 8 | pub fn hello() -> Html { 9 | let history = use_history().unwrap(); 10 | let onclick = Callback::from(move |_| { 11 | history.push(Route::Home); 12 | }); 13 | 14 | html! { 15 |
16 |

{"Hello"}

17 | 18 |
19 | } 20 | } 21 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/one_complicated_state/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | pub onclick: Callback<()>, 7 | } 8 | 9 | #[function_component(CustomButton)] 10 | pub fn custom_button(props: &Props) -> Html { 11 | let onclick = props.onclick.clone(); 12 | let button_onclick = Callback::from(move |_| { 13 | onclick.emit(()); 14 | }); 15 | html! { 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_lifecycle_methods/src/components/pages/hello.rs: -------------------------------------------------------------------------------- 1 | use gloo::console::log; 2 | use yew::prelude::*; 3 | use yew_router::{history, prelude::*}; 4 | 5 | use crate::router::Route; 6 | 7 | #[function_component(Hello)] 8 | pub fn hello() -> Html { 9 | let history = use_history().unwrap(); 10 | let onclick = Callback::from(move |_| { 11 | history.push(Route::Home); 12 | }); 13 | 14 | html! { 15 |
16 |

{"Hello"}

17 | 18 |
19 | } 20 | } 21 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/styling_struct_components/src/components/pages/hello.rs: -------------------------------------------------------------------------------- 1 | use gloo::console::log; 2 | use yew::prelude::*; 3 | use yew_router::{history, prelude::*}; 4 | 5 | use crate::router::Route; 6 | 7 | #[function_component(Hello)] 8 | pub fn hello() -> Html { 9 | let history = use_history().unwrap(); 10 | let onclick = Callback::from(move |_| { 11 | history.push(Route::Home); 12 | }); 13 | 14 | html! { 15 |
16 |

{"Hello"}

17 | 18 |
19 | } 20 | } 21 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/programattic_linking_to_pages/src/components/pages/hello.rs: -------------------------------------------------------------------------------- 1 | use gloo::console::log; 2 | use yew::prelude::*; 3 | use yew_router::{history, prelude::*}; 4 | 5 | use crate::router::Route; 6 | 7 | #[function_component(Hello)] 8 | pub fn hello() -> Html { 9 | let history = use_history().unwrap(); 10 | let onclick = Callback::from(move |_| { 11 | history.push(Route::Home); 12 | }); 13 | 14 | html! { 15 |
16 |

{"Hello"}

17 | 18 |
19 | } 20 | } 21 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/passing_properties_into_components/src/lib.rs: -------------------------------------------------------------------------------- 1 | use stylist::{style, yew::styled_component, Style}; 2 | use yew::prelude::*; 3 | 4 | mod components; 5 | 6 | use components::atoms::main_title::MainTitle; 7 | 8 | const STYLE_FILE: &str = include_str!("main.css"); 9 | 10 | #[styled_component(App)] 11 | pub fn app() -> Html { 12 | let stylesheet = Style::new(STYLE_FILE).unwrap(); 13 | html! { 14 |
15 | 16 |

{"more text"}

17 |
18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/simplifying_complicated_state_updates/src/components/atoms/custom_button.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq)] 4 | pub struct Props { 5 | pub label: String, 6 | pub onclick: Callback<()>, 7 | } 8 | 9 | #[function_component(CustomButton)] 10 | pub fn custom_button(props: &Props) -> Html { 11 | let onclick = props.onclick.clone(); 12 | let button_onclick = Callback::from(move |_| { 13 | onclick.emit(()); 14 | }); 15 | html! { 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_components/src/components/atoms/struct_hello.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | pub struct StructHello { 4 | pub message: String, 5 | } 6 | 7 | impl Component for StructHello { 8 | type Message = (); 9 | 10 | type Properties = (); 11 | 12 | fn create(_ctx: &Context) -> Self { 13 | Self { 14 | message: "Hello World from a Struct!".to_owned(), 15 | } 16 | } 17 | 18 | fn view(&self, _ctx: &Context) -> Html { 19 | html! { 20 |

{&self.message}

21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/introduction_to_stylist/src/lib.rs: -------------------------------------------------------------------------------- 1 | use stylist::{style, yew::styled_component}; 2 | use yew::prelude::*; 3 | 4 | #[styled_component(App)] 5 | pub fn app() -> Html { 6 | let stylesheet = style!( 7 | r#" 8 | h1 { 9 | color: orange; 10 | } 11 | 12 | p { 13 | color: white; 14 | } 15 | "# 16 | ) 17 | .unwrap(); 18 | html! { 19 |
20 |

{"Hello World!!!"}

21 |

{"more text"}

22 |
23 | } 24 | } 25 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/src/routes/mirror_body_json.rs: -------------------------------------------------------------------------------- 1 | use axum::Json; 2 | use serde::{Deserialize, Serialize}; 3 | 4 | #[derive(Serialize, Deserialize, Debug)] 5 | pub struct MirrorJson { 6 | message: String, 7 | } 8 | 9 | #[derive(Serialize)] 10 | pub struct MirrorJsonResponse { 11 | message: String, 12 | message_from_server: String, 13 | } 14 | 15 | pub async fn mirror_body_json(Json(body): Json) -> Json { 16 | Json(MirrorJsonResponse { 17 | message: body.message, 18 | message_from_server: "Hello from Axum".to_owned(), 19 | }) 20 | } 21 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_state/src/lib.rs: -------------------------------------------------------------------------------- 1 | use gloo::console::log; 2 | use stylist::yew::styled_component; 3 | use yew::prelude::*; 4 | 5 | mod components; 6 | 7 | use components::atoms::main_title::{Color, MainTitle}; 8 | use components::molecules::custom_form::CustomForm; 9 | 10 | #[styled_component(App)] 11 | pub fn app() -> Html { 12 | let main_title_load = Callback::from(|message: String| log!(message)); 13 | html! { 14 |
15 | 16 | 17 |
18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/creating_a_form/src/lib.rs: -------------------------------------------------------------------------------- 1 | use gloo::console::log; 2 | use stylist::yew::styled_component; 3 | use yew::prelude::*; 4 | 5 | mod components; 6 | 7 | use components::atoms::main_title::{Color, MainTitle}; 8 | use components::molecules::custom_form::CustomForm; 9 | 10 | #[styled_component(App)] 11 | pub fn app() -> Html { 12 | let main_title_load = Callback::from(|message: String| log!(message)); 13 | html! { 14 |
15 | 16 | 17 |
18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/multiple_states/src/lib.rs: -------------------------------------------------------------------------------- 1 | use gloo::console::log; 2 | use stylist::yew::styled_component; 3 | use yew::prelude::*; 4 | 5 | mod components; 6 | 7 | use components::atoms::main_title::{Color, MainTitle}; 8 | use components::molecules::custom_form::CustomForm; 9 | 10 | #[styled_component(App)] 11 | pub fn app() -> Html { 12 | let main_title_load = Callback::from(|message: String| log!(message)); 13 | html! { 14 |
15 | 16 | 17 |
18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/one_complicated_state/src/lib.rs: -------------------------------------------------------------------------------- 1 | use gloo::console::log; 2 | use stylist::yew::styled_component; 3 | use yew::prelude::*; 4 | 5 | mod components; 6 | 7 | use components::atoms::main_title::{Color, MainTitle}; 8 | use components::molecules::custom_form::CustomForm; 9 | 10 | #[styled_component(App)] 11 | pub fn app() -> Html { 12 | let main_title_load = Callback::from(|message: String| log!(message)); 13 | html! { 14 |
15 | 16 | 17 |
18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_text_field_events/src/lib.rs: -------------------------------------------------------------------------------- 1 | use gloo::console::log; 2 | use stylist::yew::styled_component; 3 | use yew::prelude::*; 4 | 5 | mod components; 6 | 7 | use components::atoms::main_title::{Color, MainTitle}; 8 | use components::molecules::custom_form::CustomForm; 9 | 10 | #[styled_component(App)] 11 | pub fn app() -> Html { 12 | let main_title_load = Callback::from(|message: String| log!(message)); 13 | html! { 14 |
15 | 16 | 17 |
18 | } 19 | } 20 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/routes/users/logout.rs: -------------------------------------------------------------------------------- 1 | use axum::{extract::State, http::StatusCode, Extension}; 2 | use sea_orm::{DatabaseConnection, IntoActiveModel, Set}; 3 | 4 | use crate::{ 5 | database::users, queries::user_queries::save_active_user, utilities::app_error::AppError, 6 | }; 7 | 8 | pub async fn logout( 9 | Extension(user): Extension, 10 | State(db): State, 11 | ) -> Result { 12 | let mut user = user.into_active_model(); 13 | 14 | user.token = Set(None); 15 | 16 | save_active_user(&db, user).await?; 17 | 18 | Ok(StatusCode::OK) 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/simplifying_complicated_state_updates/src/lib.rs: -------------------------------------------------------------------------------- 1 | use gloo::console::log; 2 | use stylist::yew::styled_component; 3 | use yew::prelude::*; 4 | 5 | mod components; 6 | 7 | use components::atoms::main_title::{Color, MainTitle}; 8 | use components::molecules::custom_form::CustomForm; 9 | 10 | #[styled_component(App)] 11 | pub fn app() -> Html { 12 | let main_title_load = Callback::from(|message: String| log!(message)); 13 | html! { 14 |
15 | 16 | 17 |
18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/set_timeout/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } 14 | yew-router = "0.16.0" 15 | yewdux = "0.7.0" 16 | yewdux-functional = "0.1.0" 17 | serde = "1.0.136" 18 | reqwasm = "0.5.0" 19 | bounce = "0.2.0" 20 | wasm-bindgen-futures = "0.4.29" 21 | serde_json = "1.0.79" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/http_get_requests/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } 14 | yew-router = "0.16.0" 15 | yewdux = "0.7.0" 16 | yewdux-functional = "0.1.0" 17 | serde = "1.0.136" 18 | reqwasm = "0.5.0" 19 | bounce = "0.2.0" 20 | wasm-bindgen-futures = "0.4.29" 21 | serde_json = "1.0.79" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/http_post_requests/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } 14 | yew-router = "0.16.0" 15 | yewdux = "0.7.0" 16 | yewdux-functional = "0.1.0" 17 | serde = "1.0.136" 18 | reqwasm = "0.5.0" 19 | bounce = "0.2.0" 20 | wasm-bindgen-futures = "0.4.29" 21 | serde_json = "1.0.79" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_static_files/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } 14 | yew-router = "0.16.0" 15 | yewdux = "0.7.0" 16 | yewdux-functional = "0.1.0" 17 | serde = "1.0.136" 18 | reqwasm = "0.5.0" 19 | bounce = "0.2.0" 20 | wasm-bindgen-futures = "0.4.29" 21 | serde_json = "1.0.79" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/dynamically_setting_the_api_uri/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "introduction_to_yewrs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = "0.19.3" 10 | stylist = { version = "0.10.0", features = ["yew"]} 11 | gloo = "0.6.1" 12 | wasm-bindgen = "0.2.79" 13 | web-sys = { version = "0.3.56", features = ["HtmlInputElement"] } 14 | yew-router = "0.16.0" 15 | yewdux = "0.7.0" 16 | yewdux-functional = "0.1.0" 17 | serde = "1.0.136" 18 | reqwasm = "0.5.0" 19 | bounce = "0.2.0" 20 | wasm-bindgen-futures = "0.4.29" 21 | serde_json = "1.0.79" -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/using_yewdux_to_store_form_data/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod auth_form; 2 | mod display_auth; 3 | mod stores; 4 | 5 | use auth_form::AuthForm; 6 | use display_auth::DisplayAuth; 7 | use yew::prelude::*; 8 | 9 | pub struct App; 10 | 11 | impl Component for App { 12 | type Message = (); 13 | 14 | type Properties = (); 15 | 16 | fn create(_ctx: &Context) -> Self { 17 | Self 18 | } 19 | 20 | fn view(&self, _ctx: &Context) -> Html { 21 | html! { 22 |
23 |

{"App"}

24 | 25 | 26 |
27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yewdux/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod display_count; 2 | mod increment_count; 3 | mod stores; 4 | 5 | use display_count::DisplayCount; 6 | use increment_count::IncrementCount; 7 | use yew::prelude::*; 8 | 9 | pub struct App {} 10 | 11 | impl Component for App { 12 | type Message = (); 13 | 14 | type Properties = (); 15 | 16 | fn create(_ctx: &Context) -> Self { 17 | Self {} 18 | } 19 | 20 | fn view(&self, _ctx: &Context) -> Html { 21 | html! { 22 |
23 |

{"App"}

24 | 25 | 26 |
27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /frontend/rust/yew/solution/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "solution" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | yew = { version = "0.20.0", features = ["csr"] } 10 | yew-router = "0.17.0" 11 | stylist = { version = "0.11.0", features = ["yew"] } 12 | wasm-bindgen = "0.2.80" 13 | web-sys = { version = "0.3.57", features = ["HtmlInputElement", "HtmlSelectElement"] } 14 | gloo = "0.8.0" 15 | reqwasm = "0.5.0" 16 | wasm-bindgen-futures = "0.4.30" 17 | serde = "1.0.136" 18 | serde_json = "1.0.79" 19 | yewdux = "0.9.0" 20 | dotenv = "0.15.0" 21 | thiserror = "1.0.30" 22 | js-sys = "0.3.57" 23 | -------------------------------------------------------------------------------- /backend/nodejs/express/routes/utilities.js: -------------------------------------------------------------------------------- 1 | const { getByToken } = require("../database/userQueries"); 2 | 3 | async function authenticate(req, res, next) { 4 | const token = req.headers["x-auth-token"]; 5 | if(!token) { 6 | const error = new Error("not authenticated!"); 7 | error.code = 401; 8 | return next(error); 9 | } 10 | 11 | try { 12 | const user = await getByToken(token); 13 | if(!user) { 14 | const error = new Error("not authenticated!"); 15 | error.code = 401; 16 | return next(error); 17 | } 18 | req.user = user; 19 | return next(); 20 | } catch (error) { 21 | return next(error); 22 | } 23 | } 24 | 25 | module.exports = { 26 | authenticate, 27 | } -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/logging_to_the_console/src/lib.rs: -------------------------------------------------------------------------------- 1 | use std::any::type_name; 2 | 3 | use gloo::console::log; 4 | use serde::{Deserialize, Serialize}; 5 | use yew::prelude::*; 6 | 7 | #[derive(Serialize, Deserialize)] 8 | struct MyObject { 9 | username: String, 10 | favorite_language: String, 11 | } 12 | 13 | #[function_component(App)] 14 | pub fn app() -> Html { 15 | let name = "Brooks"; 16 | let my_object = MyObject { 17 | username: name.to_owned(), 18 | favorite_language: "Rust".to_owned(), 19 | }; 20 | 21 | log!("my name is", name); 22 | log!(serde_json::to_string_pretty(&my_object).unwrap()); 23 | html! { 24 |

{"Hello World!!!"}

25 | } 26 | } 27 | -------------------------------------------------------------------------------- /backend/nodejs/express/app.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config() 2 | 3 | const bodyParser = require('body-parser'); 4 | const express = require('express'); 5 | const {tasksRouter, usersRouter} = require('./routes'); 6 | const cors = require('cors'); 7 | const morgan = require('morgan'); 8 | 9 | const app = express(); 10 | const port = process.env.PORT || 3000; 11 | 12 | app.use(cors()); 13 | app.use(bodyParser.json()); 14 | app.use(morgan("dev")) 15 | 16 | app.use("/api/v1/tasks", tasksRouter); 17 | app.use("/api/v1/users", usersRouter); 18 | 19 | app.use((error, req, res, next) => { 20 | res.status(error.code || 500).json({error: error.message}); 21 | }) 22 | 23 | app.listen(port, () => { 24 | console.info(`backend listening on port ${port}`); 25 | }) -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_text_field_events/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use gloo::console::log; 2 | use wasm_bindgen::JsCast; 3 | use web_sys::HtmlInputElement; 4 | use yew::prelude::*; 5 | 6 | #[derive(Properties, PartialEq)] 7 | pub struct Props { 8 | pub name: String, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let onchange = Callback::from(|event: Event| { 14 | let value = event 15 | .target() 16 | .unwrap() 17 | .unchecked_into::() 18 | .value(); 19 | log!(value); 20 | }); 21 | html! { 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /frontend/rust/yew/README.md: -------------------------------------------------------------------------------- 1 | # Introduction to Yew 2 | 3 | ## Video Lessons 4 | 5 | - [ ] Updating to Yew 0.20 6 | - [ ] Reviewing the 0.20 changelog 7 | - [ ] Update the solution to 0.20 8 | - Open the solution only in VS Code 9 | - Set up docker to run express server and database 10 | - possibly run `docker system prune` to remove old docker networks in case of docker compose errors 11 | - Start frontend 12 | - Run Cypress tests 13 | - Possibly update Cypress 14 | - Yew needs `csr` feature 15 | - Run server 16 | - Maybe need to delete `Cargo.toml` file in case of bad versions 17 | - Fix problems 18 | - Errors 19 | - Stylist is putting debug string into classes, switch to style! macro instead of css! macro 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/solution/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Introduction to Yew.rs 8 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_state/src/components/molecules/custom_form.rs: -------------------------------------------------------------------------------- 1 | use crate::components::atoms::custom_button::CustomButton; 2 | use crate::components::atoms::text_input::TextInput; 3 | use yew::prelude::*; 4 | 5 | #[function_component(CustomForm)] 6 | pub fn custom_form() -> Html { 7 | let username_state = use_state(|| "no username set".to_owned()); 8 | let cloned_username_state = username_state.clone(); 9 | let username_changed = Callback::from(move |username| { 10 | cloned_username_state.set(username); 11 | }); 12 | html! { 13 |
14 | 15 | 16 |

{"Username: "}{&*username_state}

17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/bootstrap_css/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /integration-tests/frontend-tests/cypress/support/e2e.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands' 18 | 19 | // Alternatively you can use CommonJS syntax: 20 | // require('./commands') 21 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/data/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "data" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | axum = { version = "0.7.5", features = ["macros"] } 10 | bcrypt = "0.13.0" 11 | chrono = { version = "0.4.23", features = ["serde"] } 12 | dotenvy = "0.15.6" 13 | dotenvy_macro = "0.15.1" 14 | jsonwebtoken = "8.1.1" 15 | sea-orm = { version = "0.10.1", features = ["sqlx-postgres", "runtime-tokio-rustls"] } 16 | serde = { version = "1.0.147", features = ["derive"] } 17 | serde_with = "2.1.0" 18 | tokio = { version = "1.21.2", features = ["full"] } 19 | validator = { version = "0.16.0", features = ["derive"] } 20 | axum-extra = { version = "0.9.3", features = ["typed-header"] } 21 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/html_in_rust/src/lib.rs: -------------------------------------------------------------------------------- 1 | use std::any::type_name; 2 | 3 | use gloo::console::log; 4 | use serde::{Deserialize, Serialize}; 5 | use yew::prelude::*; 6 | 7 | #[derive(Serialize, Deserialize)] 8 | struct MyObject { 9 | username: String, 10 | favorite_language: String, 11 | } 12 | 13 | #[function_component(App)] 14 | pub fn app() -> Html { 15 | let name = "Brooks"; 16 | let my_object = MyObject { 17 | username: name.to_owned(), 18 | favorite_language: "Rust".to_owned(), 19 | }; 20 | 21 | log!("my name is", name); 22 | log!(serde_json::to_string_pretty(&my_object).unwrap()); 23 | let class = "my_title"; 24 | html! { 25 | <> 26 |

{"Hello World!!!"}

27 |

{"Hi there!"}

28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_state/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use wasm_bindgen::JsCast; 2 | use web_sys::HtmlInputElement; 3 | use yew::prelude::*; 4 | 5 | #[derive(Properties, PartialEq)] 6 | pub struct Props { 7 | pub name: String, 8 | pub handle_onchange: Callback, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let handle_onchange = props.handle_onchange.clone(); 14 | let onchange = Callback::from(move |event: Event| { 15 | let value = event 16 | .target() 17 | .unwrap() 18 | .unchecked_into::() 19 | .value(); 20 | handle_onchange.emit(value); 21 | }); 22 | html! { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "project_solution" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | axum = { version = "0.7.5", features = ["macros"] } 10 | axum-extra = { version = "0.9.3", features = ["typed-header"] } 11 | bcrypt = "0.15.1" 12 | chrono = "0.4.23" 13 | dotenvy = "0.15.6" 14 | dotenvy_macro = "0.15.1" 15 | jsonwebtoken = "9.3.0" 16 | sea-orm = { version = "1.0.0", features = ["runtime-tokio-rustls", "sqlx-postgres"] } 17 | serde = { version = "1.0.149", features = ["derive"] } 18 | serde_json = "1.0.89" 19 | serde_with = "3.9.0" 20 | tokio = { version = "1.22.0", features = ["macros", "rt-multi-thread"] } 21 | validator = { version = "0.18.1", features = ["derive"] } 22 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/routes/tasks/delete_task.rs: -------------------------------------------------------------------------------- 1 | use crate::queries::task_queries::{find_task_by_id, save_active_task}; 2 | use crate::{database::users::Model, utilities::app_error::AppError}; 3 | use axum::{ 4 | extract::{Path, State}, 5 | Extension, 6 | }; 7 | use chrono::Utc; 8 | use sea_orm::{DatabaseConnection, IntoActiveModel, Set}; 9 | 10 | pub async fn soft_delete_task( 11 | Extension(user): Extension, 12 | State(db): State, 13 | Path(task_id): Path, 14 | ) -> Result<(), AppError> { 15 | let mut task = find_task_by_id(&db, task_id, user.id) 16 | .await? 17 | .into_active_model(); 18 | 19 | let now = Utc::now(); 20 | 21 | task.deleted_at = Set(Some(now.into())); 22 | 23 | save_active_task(&db, task).await?; 24 | 25 | Ok(()) 26 | } 27 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/utilities/hash.rs: -------------------------------------------------------------------------------- 1 | use super::app_error::AppError; 2 | use axum::http::StatusCode; 3 | use bcrypt::{hash, verify}; 4 | 5 | const COST: u32 = 12; 6 | 7 | pub fn hash_password(password: &str) -> Result { 8 | hash(password, COST).map_err(|error| { 9 | eprintln!("Error hashing password: {:?}", error); 10 | AppError::new(StatusCode::INTERNAL_SERVER_ERROR, "Error securing password") 11 | }) 12 | } 13 | 14 | pub fn verify_password(password: &str, hash: &str) -> Result { 15 | verify(password, hash).map_err(|error| { 16 | eprintln!("Error verifying password: {:?}", error); 17 | AppError::new( 18 | StatusCode::INTERNAL_SERVER_ERROR, 19 | "The was a problem verifying your password", 20 | ) 21 | }) 22 | } 23 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/multiple_states/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use wasm_bindgen::JsCast; 2 | use web_sys::HtmlInputElement; 3 | use yew::prelude::*; 4 | 5 | #[derive(Properties, PartialEq)] 6 | pub struct Props { 7 | pub name: String, 8 | pub handle_onchange: Callback, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let handle_onchange = props.handle_onchange.clone(); 14 | let onchange = Callback::from(move |event: Event| { 15 | let value = event 16 | .target() 17 | .unwrap() 18 | .unchecked_into::() 19 | .value(); 20 | handle_onchange.emit(value); 21 | }); 22 | html! { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/data/src/utils/app_error.rs: -------------------------------------------------------------------------------- 1 | use axum::{http::StatusCode, response::IntoResponse, Json}; 2 | use serde::Serialize; 3 | 4 | pub struct AppError { 5 | code: StatusCode, 6 | message: String, 7 | } 8 | 9 | impl AppError { 10 | pub fn new(code: StatusCode, message: impl Into) -> Self { 11 | Self { 12 | code, 13 | message: message.into(), 14 | } 15 | } 16 | } 17 | 18 | impl IntoResponse for AppError { 19 | fn into_response(self) -> axum::response::Response { 20 | ( 21 | self.code, 22 | Json(ResponseMessage { 23 | message: self.message, 24 | }), 25 | ) 26 | .into_response() 27 | } 28 | } 29 | 30 | #[derive(Serialize)] 31 | struct ResponseMessage { 32 | message: String, 33 | } 34 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/one_complicated_state/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use wasm_bindgen::JsCast; 2 | use web_sys::HtmlInputElement; 3 | use yew::prelude::*; 4 | 5 | #[derive(Properties, PartialEq)] 6 | pub struct Props { 7 | pub name: String, 8 | pub handle_onchange: Callback, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let handle_onchange = props.handle_onchange.clone(); 14 | let onchange = Callback::from(move |event: Event| { 15 | let value = event 16 | .target() 17 | .unwrap() 18 | .unchecked_into::() 19 | .value(); 20 | handle_onchange.emit(value); 21 | }); 22 | html! { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/routing/src/routes/set_middleware_custom_header.rs: -------------------------------------------------------------------------------- 1 | use axum::{ 2 | body::Body, 3 | http::{Request, StatusCode}, 4 | middleware::Next, 5 | response::Response, 6 | }; 7 | 8 | use super::read_middleware_custom_header::HeaderMessage; 9 | 10 | pub async fn set_middleware_custom_header( 11 | mut request: Request, 12 | next: Next, 13 | ) -> Result { 14 | let headers = request.headers(); 15 | let message = headers 16 | .get("message") 17 | .ok_or_else(|| StatusCode::BAD_REQUEST)?; 18 | let message = message 19 | .to_str() 20 | .map_err(|_error| StatusCode::BAD_REQUEST)? 21 | .to_owned(); 22 | let extensions = request.extensions_mut(); 23 | 24 | extensions.insert(HeaderMessage(message)); 25 | 26 | Ok(next.run(request).await) 27 | } 28 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/simplifying_complicated_state_updates/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use wasm_bindgen::JsCast; 2 | use web_sys::HtmlInputElement; 3 | use yew::prelude::*; 4 | 5 | #[derive(Properties, PartialEq)] 6 | pub struct Props { 7 | pub name: String, 8 | pub handle_onchange: Callback, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let handle_onchange = props.handle_onchange.clone(); 14 | let onchange = Callback::from(move |event: Event| { 15 | let value = event 16 | .target() 17 | .unwrap() 18 | .unchecked_into::() 19 | .value(); 20 | handle_onchange.emit(value); 21 | }); 22 | html! { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /integration-tests/frontend-tests/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "frontend-tests", 3 | "lockfileVersion": 2, 4 | "requires": true, 5 | "packages": { 6 | "": { 7 | "devDependencies": { 8 | "faker": "^5.5.3" 9 | } 10 | }, 11 | "node_modules/faker": { 12 | "version": "5.5.3", 13 | "resolved": "https://registry.npmjs.org/faker/-/faker-5.5.3.tgz", 14 | "integrity": "sha512-wLTv2a28wjUyWkbnX7u/ABZBkUkIF2fCd73V6P2oFqEGEktDfzWx4UxrSqtPRw0xPRAcjeAOIiJWqZm3pP4u3g==", 15 | "dev": true 16 | } 17 | }, 18 | "dependencies": { 19 | "faker": { 20 | "version": "5.5.3", 21 | "resolved": "https://registry.npmjs.org/faker/-/faker-5.5.3.tgz", 22 | "integrity": "sha512-wLTv2a28wjUyWkbnX7u/ABZBkUkIF2fCd73V6P2oFqEGEktDfzWx4UxrSqtPRw0xPRAcjeAOIiJWqZm3pP4u3g==", 23 | "dev": true 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/bootstrap_css/src/text_form_field.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | #[derive(Properties, PartialEq, Clone)] 4 | pub struct Props { 5 | pub id: String, 6 | pub label: String, 7 | pub placeholder: Option, 8 | pub description: String, 9 | } 10 | 11 | #[function_component(TextFormField)] 12 | pub fn text_form_field(props: &Props) -> Html { 13 | let help_id = format!("{}-help", &props.id); 14 | 15 | html! { 16 | <> 17 | 18 | 19 | { &props.description } 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/linking_to_pages/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use wasm_bindgen::JsCast; 2 | use web_sys::HtmlInputElement; 3 | use yew::prelude::*; 4 | 5 | #[derive(Properties, PartialEq)] 6 | pub struct Props { 7 | pub name: String, 8 | pub handle_onchange: Callback, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let handle_onchange = props.handle_onchange.clone(); 14 | let onchange = Callback::from(move |event: Event| { 15 | let value = event 16 | .target() 17 | .unwrap() 18 | .unchecked_into::() 19 | .value(); 20 | handle_onchange.emit(value); 21 | }); 22 | html! { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_components/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use wasm_bindgen::JsCast; 2 | use web_sys::HtmlInputElement; 3 | use yew::prelude::*; 4 | 5 | #[derive(Properties, PartialEq)] 6 | pub struct Props { 7 | pub name: String, 8 | pub handle_onchange: Callback, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let handle_onchange = props.handle_onchange.clone(); 14 | let onchange = Callback::from(move |event: Event| { 15 | let value = event 16 | .target() 17 | .unwrap() 18 | .unchecked_into::() 19 | .value(); 20 | handle_onchange.emit(value); 21 | }); 22 | html! { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_messages/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use wasm_bindgen::JsCast; 2 | use web_sys::HtmlInputElement; 3 | use yew::prelude::*; 4 | 5 | #[derive(Properties, PartialEq)] 6 | pub struct Props { 7 | pub name: String, 8 | pub handle_onchange: Callback, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let handle_onchange = props.handle_onchange.clone(); 14 | let onchange = Callback::from(move |event: Event| { 15 | let value = event 16 | .target() 17 | .unwrap() 18 | .unchecked_into::() 19 | .value(); 20 | handle_onchange.emit(value); 21 | }); 22 | html! { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_properties/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use wasm_bindgen::JsCast; 2 | use web_sys::HtmlInputElement; 3 | use yew::prelude::*; 4 | 5 | #[derive(Properties, PartialEq)] 6 | pub struct Props { 7 | pub name: String, 8 | pub handle_onchange: Callback, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let handle_onchange = props.handle_onchange.clone(); 14 | let onchange = Callback::from(move |event: Event| { 15 | let value = event 16 | .target() 17 | .unwrap() 18 | .unchecked_into::() 19 | .value(); 20 | handle_onchange.emit(value); 21 | }); 22 | html! { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_context_hook/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use wasm_bindgen::JsCast; 2 | use web_sys::HtmlInputElement; 3 | use yew::prelude::*; 4 | 5 | #[derive(Properties, PartialEq)] 6 | pub struct Props { 7 | pub name: String, 8 | pub handle_onchange: Callback, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let handle_onchange = props.handle_onchange.clone(); 14 | let onchange = Callback::from(move |event: Event| { 15 | let value = event 16 | .target() 17 | .unwrap() 18 | .unchecked_into::() 19 | .value(); 20 | handle_onchange.emit(value); 21 | }); 22 | html! { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/use_effect_hook/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use wasm_bindgen::JsCast; 2 | use web_sys::HtmlInputElement; 3 | use yew::prelude::*; 4 | 5 | #[derive(Properties, PartialEq)] 6 | pub struct Props { 7 | pub name: String, 8 | pub handle_onchange: Callback, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let handle_onchange = props.handle_onchange.clone(); 14 | let onchange = Callback::from(move |event: Event| { 15 | let value = event 16 | .target() 17 | .unwrap() 18 | .unchecked_into::() 19 | .value(); 20 | handle_onchange.emit(value); 21 | }); 22 | html! { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/yewdux_functional/src/display_auth.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | use yewdux::prelude::*; 3 | 4 | use crate::store::auth_store::AuthStore; 5 | 6 | #[function_component(DisplayAuth)] 7 | pub fn display_auth() -> Html { 8 | let (store, _) = use_store::(); 9 | let username = format!( 10 | "Username: {}", 11 | store.username.as_deref().unwrap_or_default() 12 | ); 13 | let password = format!( 14 | "Password: {}", 15 | store.password.as_deref().unwrap_or_default() 16 | ); 17 | let is_authenticated = format!("Is Authenticated: {}", store.is_authenticated); 18 | 19 | html! { 20 |
21 |

{"auth data"}

22 |
{username}
23 |
{password}
24 |
{is_authenticated}
25 |
26 | } 27 | } 28 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/utilities/app_error.rs: -------------------------------------------------------------------------------- 1 | use axum::{http::StatusCode, response::IntoResponse, Json}; 2 | use serde::{Deserialize, Serialize}; 3 | 4 | pub struct AppError { 5 | code: StatusCode, 6 | message: String, 7 | } 8 | 9 | impl AppError { 10 | pub fn new(code: StatusCode, message: impl Into) -> Self { 11 | Self { 12 | code, 13 | message: message.into(), 14 | } 15 | } 16 | } 17 | 18 | impl IntoResponse for AppError { 19 | fn into_response(self) -> axum::response::Response { 20 | ( 21 | self.code, 22 | Json(ErrorResponse { 23 | error: self.message.clone(), 24 | }), 25 | ) 26 | .into_response() 27 | } 28 | } 29 | 30 | #[derive(Serialize, Deserialize)] 31 | struct ErrorResponse { 32 | error: String, 33 | } 34 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yew_router/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use wasm_bindgen::JsCast; 2 | use web_sys::HtmlInputElement; 3 | use yew::prelude::*; 4 | 5 | #[derive(Properties, PartialEq)] 6 | pub struct Props { 7 | pub name: String, 8 | pub handle_onchange: Callback, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let handle_onchange = props.handle_onchange.clone(); 14 | let onchange = Callback::from(move |event: Event| { 15 | let value = event 16 | .target() 17 | .unwrap() 18 | .unchecked_into::() 19 | .value(); 20 | handle_onchange.emit(value); 21 | }); 22 | html! { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_lifecycle_methods/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use wasm_bindgen::JsCast; 2 | use web_sys::HtmlInputElement; 3 | use yew::prelude::*; 4 | 5 | #[derive(Properties, PartialEq)] 6 | pub struct Props { 7 | pub name: String, 8 | pub handle_onchange: Callback, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let handle_onchange = props.handle_onchange.clone(); 14 | let onchange = Callback::from(move |event: Event| { 15 | let value = event 16 | .target() 17 | .unwrap() 18 | .unchecked_into::() 19 | .value(); 20 | handle_onchange.emit(value); 21 | }); 22 | html! { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_form_submit_events/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use wasm_bindgen::JsCast; 2 | use web_sys::HtmlInputElement; 3 | use yew::prelude::*; 4 | 5 | #[derive(Properties, PartialEq)] 6 | pub struct Props { 7 | pub name: String, 8 | pub handle_onchange: Callback, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let handle_onchange = props.handle_onchange.clone(); 14 | let onchange = Callback::from(move |event: Event| { 15 | let value = event 16 | .target() 17 | .unwrap() 18 | .unchecked_into::() 19 | .value(); 20 | handle_onchange.emit(value); 21 | }); 22 | html! { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/programattic_linking_to_pages/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use wasm_bindgen::JsCast; 2 | use web_sys::HtmlInputElement; 3 | use yew::prelude::*; 4 | 5 | #[derive(Properties, PartialEq)] 6 | pub struct Props { 7 | pub name: String, 8 | pub handle_onchange: Callback, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let handle_onchange = props.handle_onchange.clone(); 14 | let onchange = Callback::from(move |event: Event| { 15 | let value = event 16 | .target() 17 | .unwrap() 18 | .unchecked_into::() 19 | .value(); 20 | handle_onchange.emit(value); 21 | }); 22 | html! { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/styling_struct_components/src/components/atoms/text_input.rs: -------------------------------------------------------------------------------- 1 | use wasm_bindgen::JsCast; 2 | use web_sys::HtmlInputElement; 3 | use yew::prelude::*; 4 | 5 | #[derive(Properties, PartialEq)] 6 | pub struct Props { 7 | pub name: String, 8 | pub handle_onchange: Callback, 9 | } 10 | 11 | #[function_component(TextInput)] 12 | pub fn text_input(props: &Props) -> Html { 13 | let handle_onchange = props.handle_onchange.clone(); 14 | let onchange = Callback::from(move |event: Event| { 15 | let value = event 16 | .target() 17 | .unwrap() 18 | .unchecked_into::() 19 | .value(); 20 | handle_onchange.emit(value); 21 | }); 22 | html! { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /integration-tests/frontend-tests/cypress/plugins/index.js: -------------------------------------------------------------------------------- 1 | /// 2 | // *********************************************************** 3 | // This example plugins/index.js can be used to load plugins 4 | // 5 | // You can change the location of this file or turn off loading 6 | // the plugins file with the 'pluginsFile' configuration option. 7 | // 8 | // You can read more here: 9 | // https://on.cypress.io/plugins-guide 10 | // *********************************************************** 11 | 12 | // This function is called when a project is opened or re-opened (e.g. due to 13 | // the project's config changing) 14 | 15 | /** 16 | * @type {Cypress.PluginConfig} 17 | */ 18 | // eslint-disable-next-line no-unused-vars 19 | module.exports = (on, config) => { 20 | // `on` is used to hook into various events Cypress emits 21 | // `config` is the resolved Cypress config 22 | } 23 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_form_submit_events/src/lib.rs: -------------------------------------------------------------------------------- 1 | use gloo::console::log; 2 | use stylist::yew::styled_component; 3 | use yew::prelude::*; 4 | 5 | mod components; 6 | 7 | use components::atoms::main_title::{Color, MainTitle}; 8 | use components::molecules::custom_form::CustomForm; 9 | 10 | use crate::components::molecules::custom_form::Data; 11 | 12 | #[styled_component(App)] 13 | pub fn app() -> Html { 14 | let main_title_load = Callback::from(|message: String| log!(message)); 15 | let custom_form_submit = Callback::from(|data: Data| { 16 | log!("username is", data.username); 17 | log!("favorite language is", data.favorite_language); 18 | }); 19 | html! { 20 |
21 | 22 | 23 |
24 | } 25 | } 26 | -------------------------------------------------------------------------------- /backend/rust/axum/lessons/data/src/database/users.rs: -------------------------------------------------------------------------------- 1 | //! SeaORM Entity. Generated by sea-orm-codegen 0.9.2 2 | 3 | use sea_orm::entity::prelude::*; 4 | 5 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] 6 | #[sea_orm(table_name = "users")] 7 | pub struct Model { 8 | #[sea_orm(primary_key)] 9 | pub id: i32, 10 | #[sea_orm(unique)] 11 | pub username: String, 12 | pub password: String, 13 | pub deleted_at: Option, 14 | #[sea_orm(column_type = "Text", nullable)] 15 | pub token: Option, 16 | } 17 | 18 | #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] 19 | pub enum Relation { 20 | #[sea_orm(has_many = "super::tasks::Entity")] 21 | Tasks, 22 | } 23 | 24 | impl Related for Entity { 25 | fn to() -> RelationDef { 26 | Relation::Tasks.def() 27 | } 28 | } 29 | 30 | impl ActiveModelBehavior for ActiveModel {} 31 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/database/users.rs: -------------------------------------------------------------------------------- 1 | //! SeaORM Entity. Generated by sea-orm-codegen 0.9.2 2 | 3 | use sea_orm::entity::prelude::*; 4 | 5 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] 6 | #[sea_orm(table_name = "users")] 7 | pub struct Model { 8 | #[sea_orm(primary_key)] 9 | pub id: i32, 10 | #[sea_orm(unique)] 11 | pub username: String, 12 | pub password: String, 13 | pub deleted_at: Option, 14 | #[sea_orm(column_type = "Text", nullable)] 15 | pub token: Option, 16 | } 17 | 18 | #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] 19 | pub enum Relation { 20 | #[sea_orm(has_many = "super::tasks::Entity")] 21 | Tasks, 22 | } 23 | 24 | impl Related for Entity { 25 | fn to() -> RelationDef { 26 | Relation::Tasks.def() 27 | } 28 | } 29 | 30 | impl ActiveModelBehavior for ActiveModel {} 31 | -------------------------------------------------------------------------------- /frontend/js/vue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "code", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "preserve": "npm i", 7 | "serve": "vue-cli-service serve", 8 | "build": "vue-cli-service build", 9 | "lint": "vue-cli-service lint" 10 | }, 11 | "dependencies": { 12 | "@vue/composition-api": "^1.4.5", 13 | "axios": "^0.25.0", 14 | "core-js": "^3.6.5", 15 | "lodash": "^4.17.21", 16 | "vue": "^2.6.11", 17 | "vue-router": "^3.2.0", 18 | "vuex": "^3.4.0" 19 | }, 20 | "devDependencies": { 21 | "@vue/cli-plugin-babel": "~4.5.0", 22 | "@vue/cli-plugin-eslint": "~4.5.0", 23 | "@vue/cli-plugin-router": "~4.5.0", 24 | "@vue/cli-plugin-vuex": "~4.5.0", 25 | "@vue/cli-service": "~4.5.0", 26 | "babel-eslint": "^10.1.0", 27 | "eslint": "^6.7.2", 28 | "eslint-plugin-vue": "^6.2.2", 29 | "vue-template-compiler": "^2.6.11" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/styling_struct_components/src/components/atoms/struct_hello.rs: -------------------------------------------------------------------------------- 1 | use stylist::{style, Style}; 2 | use yew::prelude::*; 3 | 4 | pub struct StructHello { 5 | pub message: String, 6 | pub stylesheet: Style, 7 | } 8 | 9 | impl StructHello { 10 | fn style() -> Style { 11 | style!( 12 | r#" 13 | color: green; 14 | "# 15 | ) 16 | .unwrap() 17 | } 18 | } 19 | 20 | impl Component for StructHello { 21 | type Message = (); 22 | 23 | type Properties = (); 24 | 25 | fn create(_ctx: &Context) -> Self { 26 | Self { 27 | message: "Hello World from a Struct!".to_owned(), 28 | stylesheet: Self::style(), 29 | } 30 | } 31 | 32 | fn view(&self, _ctx: &Context) -> Html { 33 | html! { 34 |

{&self.message}

35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/main.rs: -------------------------------------------------------------------------------- 1 | use dotenvy::dotenv; 2 | use project_solution::{app_state::AppState, run, utilities::token_wrapper::TokenWrapper}; 3 | use sea_orm::Database; 4 | 5 | #[tokio::main] 6 | async fn main() { 7 | dotenv().ok(); 8 | let database_url = std::env::var("DATABASE_URL") 9 | .expect("Missing environment variable DATABASE_URL") 10 | .to_owned(); 11 | let jwt_secret = std::env::var("JWT_SECRET") 12 | .expect("Missing environment variable JWT_SECRET") 13 | .to_owned(); 14 | let db = match Database::connect(database_url).await { 15 | Ok(db) => db, 16 | Err(error) => { 17 | eprintln!("Error connecting to the database: {:?}", error); 18 | panic!(); 19 | } 20 | }; 21 | let app_state = AppState { 22 | db, 23 | jwt_secret: TokenWrapper(jwt_secret), 24 | }; 25 | 26 | run(app_state).await; 27 | } 28 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/persistant_state/src/display.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | use yewdux::prelude::*; 3 | use yewdux_functional::use_store; 4 | 5 | use crate::store::YewduxStore; 6 | 7 | #[function_component(Display)] 8 | pub fn view() -> Html { 9 | let store = use_store::>(); 10 | let username = store 11 | .state() 12 | .map(|state| state.username.clone()) 13 | .unwrap_or_default(); 14 | let password = store 15 | .state() 16 | .map(|state| state.password.clone()) 17 | .unwrap_or_default(); 18 | let token = store 19 | .state() 20 | .map(|state| state.token.clone()) 21 | .unwrap_or_default(); 22 | 23 | html! { 24 |
25 |

{"Display Form"}

26 |

{format!("Username: {}, Password: {}", username, password)}

27 |

{format!("token: {}", token)}

28 |
29 | } 30 | } 31 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_properties/src/components/atoms/struct_hello.rs: -------------------------------------------------------------------------------- 1 | use stylist::{style, Style}; 2 | use yew::prelude::*; 3 | 4 | #[derive(Properties, PartialEq)] 5 | pub struct Props { 6 | pub message: String, 7 | } 8 | 9 | pub struct StructHello { 10 | pub stylesheet: Style, 11 | } 12 | 13 | impl StructHello { 14 | fn style() -> Style { 15 | style!( 16 | r#" 17 | color: green; 18 | "# 19 | ) 20 | .unwrap() 21 | } 22 | } 23 | 24 | impl Component for StructHello { 25 | type Message = (); 26 | 27 | type Properties = Props; 28 | 29 | fn create(_ctx: &Context) -> Self { 30 | Self { 31 | stylesheet: Self::style(), 32 | } 33 | } 34 | 35 | fn view(&self, context: &Context) -> Html { 36 | html! { 37 |

{&context.props().message}

38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/set_timeout/src/display.rs: -------------------------------------------------------------------------------- 1 | use yew::{function_component, html}; 2 | use yewdux::prelude::PersistentStore; 3 | use yewdux_functional::use_store; 4 | 5 | use crate::store::YewduxStore; 6 | 7 | #[function_component(Display)] 8 | pub fn view() -> Html { 9 | let store = use_store::>(); 10 | let username = store 11 | .state() 12 | .map(|state| state.username.clone()) 13 | .unwrap_or_default(); 14 | let password = store 15 | .state() 16 | .map(|state| state.password.clone()) 17 | .unwrap_or_default(); 18 | let token = store 19 | .state() 20 | .map(|state| state.token.clone()) 21 | .unwrap_or_default(); 22 | 23 | html! { 24 |
25 |

{"Display Form"}

26 |

{format!("Username: {}, Password: {}", username, password)}

27 |

{format!("token: {}", token)}

28 |
29 | } 30 | } 31 | -------------------------------------------------------------------------------- /frontend/js/vue/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | import Home from '../views/Home.vue' 4 | import CreateAccount from '../views/CreateAccount.vue' 5 | import Login from '../views/Login.vue' 6 | import Task from '../views/Task.vue'; 7 | import AddTask from '../views/AddTask.vue'; 8 | 9 | Vue.use(VueRouter) 10 | 11 | const routes = [ 12 | { 13 | path: '/', 14 | name: 'Home', 15 | component: Home 16 | }, 17 | { 18 | path: '/create-account', 19 | component: CreateAccount, 20 | }, 21 | { 22 | path: '/login', 23 | component: Login 24 | }, 25 | { 26 | path: '/tasks/:taskId', 27 | component: Task, 28 | name: "one task" 29 | }, 30 | { 31 | path: '/add-task', 32 | component: AddTask, 33 | name: "add task" 34 | } 35 | ] 36 | 37 | const router = new VueRouter({ 38 | mode: 'history', 39 | base: process.env.BASE_URL, 40 | routes 41 | }) 42 | 43 | export default router 44 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/http_get_requests/src/display.rs: -------------------------------------------------------------------------------- 1 | use yew::{function_component, html}; 2 | use yewdux::prelude::PersistentStore; 3 | use yewdux_functional::use_store; 4 | 5 | use crate::store::YewduxStore; 6 | 7 | #[function_component(Display)] 8 | pub fn view() -> Html { 9 | let store = use_store::>(); 10 | let username = store 11 | .state() 12 | .map(|state| state.username.clone()) 13 | .unwrap_or_default(); 14 | let password = store 15 | .state() 16 | .map(|state| state.password.clone()) 17 | .unwrap_or_default(); 18 | let token = store 19 | .state() 20 | .map(|state| state.token.clone()) 21 | .unwrap_or_default(); 22 | 23 | html! { 24 |
25 |

{"Display Form"}

26 |

{format!("Username: {}, Password: {}", username, password)}

27 |

{format!("token: {}", token)}

28 |
29 | } 30 | } 31 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/http_post_requests/src/api.rs: -------------------------------------------------------------------------------- 1 | use reqwasm::http::Request; 2 | use serde::{Deserialize, Serialize}; 3 | use serde_json::json; 4 | 5 | #[derive(Serialize, Deserialize)] 6 | pub struct ApiLoginResponse { 7 | pub id: u32, 8 | pub username: String, 9 | pub token: String, 10 | } 11 | 12 | #[derive(Serialize, Deserialize)] 13 | struct ApiLoginResponseData { 14 | pub data: ApiLoginResponse, 15 | } 16 | 17 | pub async fn api_login(username: String, password: String) -> ApiLoginResponse { 18 | let body = json!({ 19 | "username": username, 20 | "password": password 21 | }); 22 | let response = Request::post("http://localhost:3000/api/v1/users/login") 23 | .header("content-type", "application/json") 24 | .body(body.to_string()) 25 | .send() 26 | .await 27 | .unwrap() 28 | .json::() 29 | .await 30 | .unwrap(); 31 | 32 | response.data 33 | } 34 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/http_post_requests/src/display.rs: -------------------------------------------------------------------------------- 1 | use yew::{function_component, html}; 2 | use yewdux::prelude::PersistentStore; 3 | use yewdux_functional::use_store; 4 | 5 | use crate::store::YewduxStore; 6 | 7 | #[function_component(Display)] 8 | pub fn view() -> Html { 9 | let store = use_store::>(); 10 | let username = store 11 | .state() 12 | .map(|state| state.username.clone()) 13 | .unwrap_or_default(); 14 | let password = store 15 | .state() 16 | .map(|state| state.password.clone()) 17 | .unwrap_or_default(); 18 | let token = store 19 | .state() 20 | .map(|state| state.token.clone()) 21 | .unwrap_or_default(); 22 | 23 | html! { 24 |
25 |

{"Display Form"}

26 |

{format!("Username: {}, Password: {}", username, password)}

27 |

{format!("token: {}", token)}

28 |
29 | } 30 | } 31 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_static_files/src/display.rs: -------------------------------------------------------------------------------- 1 | use yew::{function_component, html}; 2 | use yewdux::prelude::PersistentStore; 3 | use yewdux_functional::use_store; 4 | 5 | use crate::store::YewduxStore; 6 | 7 | #[function_component(Display)] 8 | pub fn view() -> Html { 9 | let store = use_store::>(); 10 | let username = store 11 | .state() 12 | .map(|state| state.username.clone()) 13 | .unwrap_or_default(); 14 | let password = store 15 | .state() 16 | .map(|state| state.password.clone()) 17 | .unwrap_or_default(); 18 | let token = store 19 | .state() 20 | .map(|state| state.token.clone()) 21 | .unwrap_or_default(); 22 | 23 | html! { 24 |
25 |

{"Display Form"}

26 |

{format!("Username: {}, Password: {}", username, password)}

27 |

{format!("token: {}", token)}

28 |
29 | } 30 | } 31 | -------------------------------------------------------------------------------- /frontend/js/vue/src/components/FormInput.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 30 | 31 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/dynamically_setting_the_api_uri/src/display.rs: -------------------------------------------------------------------------------- 1 | use yew::{function_component, html}; 2 | use yewdux::prelude::PersistentStore; 3 | use yewdux_functional::use_store; 4 | 5 | use crate::store::YewduxStore; 6 | 7 | #[function_component(Display)] 8 | pub fn view() -> Html { 9 | let store = use_store::>(); 10 | let username = store 11 | .state() 12 | .map(|state| state.username.clone()) 13 | .unwrap_or_default(); 14 | let password = store 15 | .state() 16 | .map(|state| state.password.clone()) 17 | .unwrap_or_default(); 18 | let token = store 19 | .state() 20 | .map(|state| state.token.clone()) 21 | .unwrap_or_default(); 22 | 23 | html! { 24 |
25 |

{"Display Form"}

26 |

{format!("Username: {}, Password: {}", username, password)}

27 |

{format!("token: {}", token)}

28 |
29 | } 30 | } 31 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/set_timeout/src/api/mod.rs: -------------------------------------------------------------------------------- 1 | use reqwasm::http::Request; 2 | use serde::{Deserialize, Serialize}; 3 | use serde_json::json; 4 | 5 | const BASE_API_URI: &str = include_str!("base_api_uri.txt"); 6 | 7 | #[derive(Serialize, Deserialize)] 8 | pub struct ApiLoginResponse { 9 | pub id: u32, 10 | pub username: String, 11 | pub token: String, 12 | } 13 | 14 | #[derive(Serialize, Deserialize)] 15 | struct ApiLoginResponseData { 16 | pub data: ApiLoginResponse, 17 | } 18 | 19 | pub async fn api_login(username: String, password: String) -> ApiLoginResponse { 20 | let body = json!({ 21 | "username": username, 22 | "password": password 23 | }); 24 | let response = Request::post(&format!("{}/users/login", BASE_API_URI)) 25 | .header("content-type", "application/json") 26 | .body(body.to_string()) 27 | .send() 28 | .await 29 | .unwrap() 30 | .json::() 31 | .await 32 | .unwrap(); 33 | 34 | response.data 35 | } 36 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/handling_static_files/src/api/mod.rs: -------------------------------------------------------------------------------- 1 | use reqwasm::http::Request; 2 | use serde::{Deserialize, Serialize}; 3 | use serde_json::json; 4 | 5 | const BASE_API_URI: &str = include_str!("base_api_uri.txt"); 6 | 7 | #[derive(Serialize, Deserialize)] 8 | pub struct ApiLoginResponse { 9 | pub id: u32, 10 | pub username: String, 11 | pub token: String, 12 | } 13 | 14 | #[derive(Serialize, Deserialize)] 15 | struct ApiLoginResponseData { 16 | pub data: ApiLoginResponse, 17 | } 18 | 19 | pub async fn api_login(username: String, password: String) -> ApiLoginResponse { 20 | let body = json!({ 21 | "username": username, 22 | "password": password 23 | }); 24 | let response = Request::post(&format!("{}/users/login", BASE_API_URI)) 25 | .header("content-type", "application/json") 26 | .body(body.to_string()) 27 | .send() 28 | .await 29 | .unwrap() 30 | .json::() 31 | .await 32 | .unwrap(); 33 | 34 | response.data 35 | } 36 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/routes/tasks/get_one_task.rs: -------------------------------------------------------------------------------- 1 | use crate::queries::task_queries; 2 | use crate::{database::users::Model, utilities::app_error::AppError}; 3 | use axum::Json; 4 | use axum::{ 5 | extract::{Path, State}, 6 | Extension, 7 | }; 8 | use sea_orm::DatabaseConnection; 9 | 10 | use super::{ResponseDataTask, ResponseTask}; 11 | 12 | pub async fn get_one_task( 13 | Path(task_id): Path, 14 | State(db): State, 15 | Extension(user): Extension, 16 | ) -> Result, AppError> { 17 | let task = task_queries::find_task_by_id(&db, task_id, user.id).await?; 18 | 19 | let response_task = ResponseTask { 20 | id: task.id, 21 | title: task.title, 22 | description: task.description, 23 | priority: task.priority, 24 | completed_at: task 25 | .completed_at 26 | .map(|completed_at| completed_at.to_string()), 27 | }; 28 | 29 | Ok(Json(ResponseDataTask { 30 | data: response_task, 31 | })) 32 | } 33 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/dynamically_setting_the_api_uri/src/api/mod.rs: -------------------------------------------------------------------------------- 1 | use reqwasm::http::Request; 2 | use serde::{Deserialize, Serialize}; 3 | use serde_json::json; 4 | 5 | const BASE_API_URI: &str = include_str!("base_api_uri.txt"); 6 | 7 | #[derive(Serialize, Deserialize)] 8 | pub struct ApiLoginResponse { 9 | pub id: u32, 10 | pub username: String, 11 | pub token: String, 12 | } 13 | 14 | #[derive(Serialize, Deserialize)] 15 | struct ApiLoginResponseData { 16 | pub data: ApiLoginResponse, 17 | } 18 | 19 | pub async fn api_login(username: String, password: String) -> ApiLoginResponse { 20 | let body = json!({ 21 | "username": username, 22 | "password": password 23 | }); 24 | let response = Request::post(&format!("{}/users/login", BASE_API_URI)) 25 | .header("content-type", "application/json") 26 | .body(body.to_string()) 27 | .send() 28 | .await 29 | .unwrap() 30 | .json::() 31 | .await 32 | .unwrap(); 33 | 34 | response.data 35 | } 36 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/routes/tasks/create_task.rs: -------------------------------------------------------------------------------- 1 | use axum::{extract::State, http::StatusCode, Extension, Json}; 2 | use sea_orm::DatabaseConnection; 3 | 4 | use crate::{ 5 | database::users::Model as UserModel, queries::task_queries, utilities::app_error::AppError, 6 | }; 7 | 8 | use super::{create_task_extractor::ValidateCreateTask, ResponseDataTask, ResponseTask}; 9 | 10 | pub async fn create_task( 11 | Extension(user): Extension, 12 | State(db): State, 13 | task: ValidateCreateTask, 14 | ) -> Result<(StatusCode, Json), AppError> { 15 | let task = task_queries::create_task(task, &user, &db).await?; 16 | let response = ResponseTask { 17 | id: task.id, 18 | title: task.title, 19 | description: task.description, 20 | priority: task.priority, 21 | completed_at: task.completed_at.map(|time| time.to_string()), 22 | }; 23 | 24 | Ok(( 25 | StatusCode::CREATED, 26 | Json(ResponseDataTask { data: response }), 27 | )) 28 | } 29 | -------------------------------------------------------------------------------- /backend/rust/axum/project_solution/src/routes/tasks/get_all_tasks.rs: -------------------------------------------------------------------------------- 1 | use crate::queries::task_queries; 2 | use crate::{database::users::Model as UserModel, utilities::app_error::AppError}; 3 | use axum::{extract::State, Extension, Json}; 4 | use sea_orm::DatabaseConnection; 5 | 6 | use super::{ResponseDataTasks, ResponseTask}; 7 | 8 | pub async fn get_all_tasks( 9 | Extension(user): Extension, 10 | State(db): State, 11 | ) -> Result, AppError> { 12 | let tasks = task_queries::get_all_tasks(&db, user.id, false) 13 | .await? 14 | .into_iter() 15 | .map(|db_task| ResponseTask { 16 | id: db_task.id, 17 | title: db_task.title, 18 | description: db_task.description, 19 | priority: db_task.priority, 20 | completed_at: db_task 21 | .completed_at 22 | .map(|completed_at| completed_at.to_string()), 23 | }) 24 | .collect::>(); 25 | 26 | Ok(Json(ResponseDataTasks { data: tasks })) 27 | } 28 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/struct_messages/src/components/molecules/struct_counter.rs: -------------------------------------------------------------------------------- 1 | use yew::prelude::*; 2 | 3 | pub enum StructCounterMessage { 4 | ButtonClicked(u32), 5 | } 6 | 7 | pub struct StructCounter { 8 | pub count: u32, 9 | } 10 | 11 | impl Component for StructCounter { 12 | type Message = StructCounterMessage; 13 | 14 | type Properties = (); 15 | 16 | fn create(_ctx: &Context) -> Self { 17 | Self { count: 0 } 18 | } 19 | 20 | fn view(&self, ctx: &Context) -> Html { 21 | html! { 22 |
23 | 24 |

{"I have been clicked "}{self.count}{" times"}

25 |
26 | } 27 | } 28 | 29 | fn update(&mut self, _ctx: &Context, msg: Self::Message) -> bool { 30 | match msg { 31 | StructCounterMessage::ButtonClicked(amount) => { 32 | self.count += amount; 33 | true 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /frontend/rust/yew/solution/src/router.rs: -------------------------------------------------------------------------------- 1 | use crate::pages::add_task::AddTask; 2 | use crate::pages::edit_task::EditTask; 3 | use crate::pages::one_task::OneTask; 4 | use crate::pages::{create_account::CreateAccount, home::Home, login::Login}; 5 | use yew::prelude::*; 6 | use yew_router::prelude::*; 7 | 8 | #[derive(Clone, Routable, PartialEq)] 9 | pub enum Route { 10 | #[at("/")] 11 | Home, 12 | #[at("/create-account")] 13 | CreateAccount, 14 | #[at("/login")] 15 | Login, 16 | #[at("/tasks/:id")] 17 | OneTask { id: u32 }, 18 | #[at("/tasks/:id/edit")] 19 | EditTask { id: u32 }, 20 | #[at("/tasks/add")] 21 | AddTask, 22 | } 23 | 24 | pub fn switch(route: Route) -> Html { 25 | match route { 26 | Route::Home => html! { }, 27 | Route::CreateAccount => html! { }, 28 | Route::Login => html! { }, 29 | Route::OneTask { id } => html! { }, 30 | Route::EditTask { id } => html! { }, 31 | Route::AddTask => html! { }, 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /frontend/rust/yew/lessons/setting_up_yewdux/src/display_count.rs: -------------------------------------------------------------------------------- 1 | use std::rc::Rc; 2 | 3 | use yew::prelude::*; 4 | use yewdux::prelude::*; 5 | 6 | use crate::stores::counter_store::CounterStore; 7 | 8 | pub enum Msg { 9 | Store(Rc), 10 | } 11 | 12 | pub struct DisplayCount { 13 | dispatch: Dispatch, 14 | } 15 | 16 | impl Component for DisplayCount { 17 | type Message = Msg; 18 | 19 | type Properties = (); 20 | 21 | fn create(ctx: &Context) -> Self { 22 | let dispatch = Dispatch::::subscribe(ctx.link().callback(Msg::Store)); 23 | Self { dispatch } 24 | } 25 | 26 | fn update(&mut self, _ctx: &Context, msg: Self::Message) -> bool { 27 | match msg { 28 | Msg::Store(_) => true, 29 | } 30 | } 31 | 32 | fn view(&self, _ctx: &Context) -> Html { 33 | let count = self.dispatch.get().count; 34 | 35 | html! { 36 |
37 |

{"Count"}

38 |
{count}
39 |
40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Brooks Builds 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------