Git Product home page Git Product logo

wpcodevo / fullstack-rust-app Goto Github PK

View Code? Open in Web Editor NEW
38.0 1.0 2.0 53 KB

In this article, I'll walk you through the process of building a backend API using the Actix web framework, SQLX, PostgreSQL, and Docker. Once we've created a powerful backend, we'll move on to building a single-page app using the Yew.rs framework.

Home Page: https://codevoweb.com/build-full-stack-app-with-rust-yew-and-actix-web/

Makefile 2.96% Rust 93.44% HTML 1.31% CSS 0.84% JavaScript 1.44%
actix-web docker full-stack pgadmin postgres rust sqlx sqlx-cli trunk yewdux

fullstack-rust-app's Introduction

Build a Full Stack App with Rust, Yew.rs and Actix Web

In this article, I'll walk you through the process of building a backend API using the Actix web framework, SQLX, PostgreSQL, and Docker. Once we've created a powerful backend, we'll move on to building a single-page app using the Yew.rs framework. By the end of this tutorial, you'll have a fully functional web app that seamlessly integrates the frontend app with the backend API.

Build a Full Stack App with Rust, Yew.rs and Actix Web

Topics Covered

  • Run the Full-Stack Rust App Locally
  • Setup the Full-Stack Rust App
  • Work on the Library Project
  • Work on the Backend Project
    • Setup the Rust API Project
    • Setup PostgreSQL and pgAdmin with Docker
    • Database Migration with SQLX
    • Create the SQLX Database Model
    • Create the Request Validation Structs
    • Create the CRUD API Route Handlers
    • Register the API Routes and Setup CORS
  • Work on the Frontend Project
    • Setup the Yew.rs Project
    • Setup Tailwind CSS for Styling
    • Create the API Request Functions
    • State Management with Yewdux
    • Create Reusable Components
    • Yew Component to Add New Feedback Item
    • Yew Component to Display Feedback Statistics
    • Yew Component to Display Feedback Information
    • Yew Component to Display the Feedback Items
    • Export the Component Files as Modules
    • Add the Components to the Main File
  • Test the Rust Full-Stack App

Read the entire article here: https://codevoweb.com/build-full-stack-app-with-rust-yew-and-actix-web/

fullstack-rust-app's People

Contributors

wpcodevo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

fullstack-rust-app's Issues

Error when posting new feedback

Hello,

I built the project as explained in the article but I'm getting the following errors when trying to 'POST' feedbacks:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/api/feedbacks?page=1&limit=10. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 400.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/api/feedbacks/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 400.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/api/feedbacks/. (Reason: CORS request did not succeed). Status code: (null).

I was able to fix it by replacing .allowed_origin("http://localhost:3000) to .allow_any_origin() in /backend/src/main.rs:43
Could someone explain why that is the case?
I ran the container on Debian and accessed it through the same machine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.