Example warp project
An example full stack project using the warp framework, Diesel ORM and a frontend app built with JS.
You need the Rust compiler and the cargo package manager installed. The most convenient way to get them is with Rustup:
curl https://sh.rustup.rs -sSf | sh
You'll need a PostgreSQL database running and accessible on your network, as well as the PostgreSQL C headers the Rust compiler will link with, available on Debian-based distros inside the libpq-dev
package:
sudo apt install postgresql libpq-dev ## or postgresql-10
The Diesel CLI (just the PostgreSQL features) is required, install it with:
cargo install diesel_cli --no-default-features --features postgres
You need to setup the following environment variables inside of a .env
file:
DATABASE_URL
cd app/
The frontend was built using VueJS and Parcel following this tutorial. We consume the Rust API using axios
.
Install the dependencies:
npm i -g parcel-bundler ## to get the parcel CLI
npm i
Launch the development server with hot module reloading:
parcel index.html