Skip to content

hduoc2003/axum-diesel-todoapp

Repository files navigation

Size Limit logo by Anton Lovchikov

A small Todo-app backend written in Rust using Diesel and Axum

How to run

First, you need to create some environment variable files in the root directory. Below are their names and some examples.

.env.production

HOST=0.0.0.0
PORT=1204
DATABASE=postgres
DATABASE_URL=postgres://username:password@db:5432/database_name
JWT_KEY=secret
JWT_EXPIRED_TIME=86400
RUST_LOG=DEBUG

postgres.env

POSTGRES_USER=username
POSTGRES_PASSWORD=password
POSTGRES_DB=database_name

And then, in the root of project, run docker-compose up -d. Now you can use 127.0.0.1:1204 as your backend server.

Project structure

This folder contains some migration files which auto-generated by diesel_cli.

  • api/v1
    • controllers: handler for each api.
    • db: code to handle database (such as switch between DBMS).
    • middlewares: put your middlewares here.
    • models: store your database table structure here.
    • routes: for routing your api endpoints.
    • tests: do some unit testing here.
    • types: everything related to types (Trait, Struct, ...).
    • utils: some helper functions.
  • config: Initialize server configuration.

All API endpoints are here.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published