Actix Web 3 has been superseeded by Actix Web 4.
I also have the Actix web 4 example in one of my repos, do take a look.
-
Make sure you have apt-transport-https, ca-certificates, curl, software-properties-common
-
Make sure you run
apt install build-essential
-
Make sure you run
apt install libssl-dev
-
Make sure you run
apt install pkg-config
-
Install docker, pull mysql image (make sure you don't use mysql server, just the regular mysql) from docker hub and run mysql container
-
Set your root user and password for mysql
-
`docker run --name mysql -e MYSQL_ROOT_PASSWORD=123 -d -p 3306:3306 mysql:latest
-
Use mysql in your docker container with this command
sudo docker exec -it mysql bash
-
When you're in bash, type
mysql -u root -p
-
CREATE DATABASE actix_example;
-
Modify the
DATABASE_URL
var in.env
to point to your chosen database -
Turn on the appropriate database feature for your chosen db in
Cargo.toml
(the"sqlx-mysql",
line) -
Execute
cargo run
to start the server -
Visit localhost:8000 in browser
Run server with auto-reloading:
cargo install systemfd
systemfd --no-pid -s http::8000 -- cargo watch -x run