Skip to content

Repository files navigation

rust-api-example

This is an example repo that shows how i would implement a REST API using the Rust programming language.

!! To run this project you must have Rust installed on your system !!

Requirements

Generate Public and Private key for JWT.

Run these commands:

  1. openssl genpkey -algorithm ed25519 -out keys/private.pem
  2. openssl pkey -in keys/private.pem -pubout -out keys/public.pem

Start the project

  • For SQLx to work properly, you also need to have a database.
    • Run docker compose up postgres -d to start a development database.
  • Full out a .env file with the .env.example variables.
  • Migrate your database with SQLx (sqlx migrate dev).
  • Run the command cargo run.

Using docker

  • Run docker compose up -d to start the project running in the background.

About

An example API created in Rust

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages