This would usually spark a conversation among the engineers on the team as well as the product manager in your typical business setup. Well, we certainly need their email addresses (it is an email newsletter after all). What information should we collect from a visitor in order to enroll them as a subscriber of our email newsletter?
Actix running example code#
The code for this chapter is in the chapter03-1 branch. If you haven't read the previous chapters yet (or you are not planning to) you can just get started from the code The source code of our email newsletter project is on GitHub! If all goes well, we should be able to demo the subscription page at the end of the article.
![actix running example actix running example](https://i.stack.imgur.com/eJCV6.png)
Actix running example how to#
how to avoid weird interactions between tests when working with a database.how to get our hands on a database connection in our API request handlers.how to setup and manage migrations for our database.what libraries are available to work with a PostgreSQL database in Rust ( diesel vs sqlx vs tokio-postgres).how do I parse the request body of a POST?) how to read data collected in a HTML form in actix-web (i.e.The form will trigger a POST /subscriptions call to our backend API that will actually process the information, store it and send back a response. We expect our blog visitors to input their email address in a form embedded on a web page. So that I can receive email updates when new content is published on the blog. It is now time to capitalise on what we learned to finally fulfill the first user story of our email newsletter project: In the first part of Chapter 3 we covered a fair amount of ground - we set out to implement a /health_check endpoint and that gave us the opportunity to learn more about the fundamentals of our web framework, actix-web, as well as the basics of (integration) testing for Rust APIs.
![actix running example actix running example](https://cdn-images-1.medium.com/max/957/1*iml33VlJ5CbqobIoujj_0g.png)
Our problem is building an email newsletter. Zero To Production is built around the idea of problem-based learning: choose a problem you want to solve, let the problem drive the introduction of new concepts and techniques. Zero To Production focuses on the challenges of writing Cloud-native applications with Rust. Integration Testing With Side-effectsÄiscuss the article on HackerNews or r/rust. Subscribe to the newsletter to be notified when a new episode is published.
![actix running example actix running example](https://image.slidesharecdn.com/actixanalyzerltetraining-170714030015/85/actix-analyzer-lte-training-8-320.jpg)
This article is a sample from Zero To Production In Rust, a book on backend development in Rust. A learning journal HTML forms, Databases, Integration tests