Giter Site home page Giter Site logo

xy2.dev-backend's Introduction

xy2.dev backend

Setup

Dependencies

Install rust. You need

  1. Install postgresql and setup an user and a database. After setting up an user, your connection string will be like postgresql://admin:admin@localhost, with username and password to replace.
  2. Put this variable as DATABASE_URL in a .env file at the root of the project:
DATABASE_URL=postgresql://admin:admin@localhost
  1. Install sqlx cli: cargo install sqlx-cli, providing the sqlx binary.
  2. Run the database migrations: sqlx migrate run --database-url=postgresql://admin:admin@localhost
  3. Run the app: cargo run

Set logging

Run the app with RUST_LOG variable set, for example: RUST_LOG="debug" cargo run. RUST_LOG can be set on a more precise level, see the doc for env_logger.

xy2.dev-backend's People

Contributors

xy2i avatar robjtede avatar

Stargazers

Lubomir Anastasov avatar

Watchers

 avatar  avatar

xy2.dev-backend's Issues

Switch to sqlx

sqlx is a library that uses pure sql, in contrast to diesel which is what we've been using.

I'm favoring switching to sqlx for these reasons:

  • Simplicity. I want to do a few sql queries. With Diesel I wrote a lot of boilerplate.
  • Easier to reason on. With Diesel I spent hours on two occasions trying to work around the DSL, and even after that I still don't understand it. The documentation available is some tutorials and the rust doc, which has made it hard for me to learn. We'll see if sqlx is better in this regard.

For these reasons we want to switch to sqlx.

  • Figure out how sqlx works
  • Integrate with current code
  • Port our existing migrations

Error handling with error-chain?

Right now eveyrthing is in a main with panics if there are errors. I'd like to have a better mechanism for reporting errors without relying on the backtrace directly, so we can log them for example.

Apparently there's std::backtrace, but it's not stable yet and I don't want to use nightly. I looked for a library solution, and error-chain seems useful.

Docker for CI / easy deployment

It would be nice to have a Dockerfile Right now we have no CI, and it would also help with deployment.

I don't know how this stuff works in general, so need to read up and lay out a plan.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.