Skip to content

Realworld app backend witten in Rust leveraging Tide and Sqlite

License

Notifications You must be signed in to change notification settings

Retamogordo/realword-tide-sqlite-backend

Repository files navigation

RealWorld Example App

[YOUR_FRAMEWORK] codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

This codebase was created to demonstrate a fully fledged fullstack application built with Tide including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the Tide community styleguides & best practices.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

How it works

This backend leverages rusts' tide framework for implementing the web app, and sqlite database managed as a single file. Simple configuration is available through .env file.

Getting started

Install rust

# download rustup and install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Download and install sqlite

# for Ubuntu:
apt-get install sqlite3

Configure backend by editing .env file

Build and run backend

cargo run

Configuration

You can run app with fresh database by setting DROP_DATABASE=1 in .env file. Database location and host and port are configurable as well.

Testing

Note: registering and logging in take some seconds because password hashing is CPU consuming.

Postman testing

Configure HOST=127.0.0.1 or delete HOST from .env and set HTTP_PORT=3000 and execute

cargo run

Integration Test

These tests do not cover http requests parsing, instead they introduce business logic testing steps by artificially forming middle layer server requests thus simulating local loop without involving tide framework. Execute

cargo test -- --nocapture

About

Realworld app backend witten in Rust leveraging Tide and Sqlite

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks