making practice with Axum
This is my first attempt to create a webserver with Rust and Axum.
Please consider that is absolutely experimental and everything is made for fun and learning.
Lot of improvements has to be implemented, i'll make it as soon as I improve my skill.
If you want to try it,do the following:
be sure you have the package docker-compose installed (not docker-compose-plugin)
STEP 1
- this step has to be done only the first time you run this application, or every time after you do 'docker system prune -a'. In fact it it has to be done for freeing more than 2 useless gb.
cd in axum_project folder and run:
docker build -t server .(don' t forget the '.' at the end)
docker images
if it create more than one image, then remove every images excepted for 2 named 'server' and ‘debian’ with the command: docker rmi <replace-with-IMAGE_ID>, one at the time
STEP 2
run:
docker-compose up -d
that's all.
If you want to see your database status type:
docker exec -it axum_project_db_1 bash (replace axum_project_db_1 with another name if docker gives a different name to the db container)
psql -h localhost -d postgres -U postgres (type: postgres if it asks a password)
then type:
SELECT * FROM users;
type: exit for exiting postgres shell
test it with localhost:5000/index.html
type:
docker-compose down to quit the program.