Giter Club home page Giter Club logo

axum-template's Introduction

Hello, world!

Top Langs

I'm Altair, a software engineer from Málaga

  • Backend nerd
  • Fascinated by functional programming
  • Focused on building fast & reliable software
  • Interested in Microservices, Serverless and Distributed systems

Languages and Tools

Learn next

axum-template's People

Contributors

altair-bueno avatar dependabot[bot] avatar mitsuhiko avatar mre avatar ngerakines avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

axum-template's Issues

Use Tera Context for data instead of struct

Would it be possible to enable RenderHtml to accept the Tera Context instead of a struct? Some handlers might need to return RenderHtml with different templates (and thus different Models) and as far an I can see that won't work.

Question: how could I access the Tera object with TemplateEngine

Hello,

I'm not super experience in rust nor with axum, so maybe there's an easy solution I miss, but I was wondering how I could access the Tera object while using axum-template. My goal would be to reload template using tera.full_reload() in development and only load them once in production.

Idea: simplify api

Hey,
I like what you did but would like to add suggestion (I actually wanted to create a similar crate in the first place).

It should be possible to extract the MatchedPath and Engine in the FromRequestParts Trait by introducing a Trait to extract the engine from the state (ideally the trait can be applied like FromRef via a macro).

This allows to render the tenplate via a simpler simpler function call and also it requires only 1 parameter instead of 2 for each handler.

I haven't tested if it works but it shoud simplify the api drastically for users.

Consider marking `RenderHtml` #[must_use]

I've ran into this situation:

async fn handler(
    engine: impl TemplateEngine,
) -> impl IntoResponse {
    let key = "Template key";
    let data = Person{ /* */ };
    RenderHtml(key, engine, data);
}

This renders nothing on the output and also produces no warnings!

Since RenderHtml is not marked #[must_use] the compiler happily ignored it and used the default return value of () as my IntoResponse implementation.

Having #[must_use] here would at least tell me something is up, and fix the error. (Since ; is also fairly small and easy to miss)

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.