Skip to content

Repository files navigation

SalvoWebsite Template

A slightly (kinda) modified version of the code generated by salvo-cli, with built-in postgres support via sqlx. A compose file is added to experiment

You might wanna checkout the spa branch for an example implementation with svelte (not sveltekit) and sv-router. Vite is used as a reverse proxy during developement

There are some additions to the original template, an html rendering macro for example, so i would suggest taking a look at the code before using it

For an even simpler version of the template please refer to SalvoAPI-Template

Warning

release.sh triggers a git reset --hard of the last commit in certain scenarios, so you might wanna look into that (only the code generated by the script is SUPPOSED to be reset, unless you make a commit while it's running)

Note

Also, make sure to run sqlx database setup after initializing the db for the first time to apply migrations (create the tables and the default user for example) You can also use sqlx database reset -y to reset the db and re-apply migrations during developement, as long as there are no open connections to db. Yes, that does include rust-analyzer, so you might wanna stop that and restart it after you're done

Made for personale usage, edit as needed

Original README file

Like a ship finding its course on vast seas, starting with Rust Web may feel challenging. Once mastered, you'll soar like an eagle - gaining peaceful sleep, reliable performance, and fewer bugs. May your journey be rewarding. Though the road is long, every step brings you closer to your destination.

Introduction

This is a project generated by salvo-cli. You can run the program and test according to the following commands (for non-sqlite databases, please modify the database connection string first according to the tutorial, and complete the initial work of the data). 😄 The latest version of Salvo requires Rust version 1.80. If your compilation fails, please try upgrading with rustup update.

//Run the project
cargo run
//Run tests
cargo test

Tip

  • If the database is sqlite or the database migration has been run, please use the account Pior (yes: i changed it, i could not type the original username, sorry) with password 123 to login.
  • The database connection string is in config/config.toml, but if you use sqlx or seaorm, the library itself reads the configuration from .env file to generate entities, run migrations, and validate. So when you modify the database connection string, you need to change two places at the same time.

orm doc or home page link

🎯 You have chosen sqlx, documentation can be viewed here:https://github.com/launchbadge/sqlx

sqlx_cli

SQLx's associated command-line utility for managing databases, migrations, and enabling "offline" mode with sqlx::query!() and friends. https://github.com/launchbadge/sqlx/blob/main/sqlx-cli/README.md

Data initialization

You have chosen sqlite database, the database has been initialized in the data folder.

About Salvo

You can view the salvo documentation and more examples at https://salvo.rs/ 📖. If our tools have helped you, please star salvo and salvo-cli, which will greatly encourage us. ❤️

About

A slightly (kinda) modified version of the code generated by salvo-cli, with built-in postgres support via sqlx

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages