Starter template for Svelte frontend apps with Rust Tide backend server. Contains an example of using sessions to store user login and access secure area.
Ideas taken from https://github.com/sachinbhutani/svelte-on-rust which combined rocket.rs and svelte.
NodeJs - Install
Rust - Install
Create a new project based on this template using degit and install the dependencies...
npx degit jbertovic/svelte-tide-project svelte-tide-project
cd svelte-tide-project
npm install
...then start Tide server and Rollup in two different terminals
Terminal 1: (To run the rust server)
cargo run
Terminal 2: (To build and hot reload svelte components)
npm run dev
Navigate to localhost:8080. You should see your app running.
All svelte front end code lives in src_front
directory. Save any changes live-reloading.
All tide server back end code lives in src
directory. To rebuild Rust code use cargo run after saving your changes.
All static files are served from public
directory. Including the JS code compiled by Svelte Compiler.
Currently the store for the sessions in Tide
is accomplished using a simple MemoryStore
which isn't meant for production.
To create an optimised version of the app:
npm run build
cargo build