Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional Gotham support #177

Closed
wants to merge 3 commits into from
Closed

Add optional Gotham support #177

wants to merge 3 commits into from

Conversation

kellenff
Copy link
Contributor

This pull request implements the Gotham web framework's IntoResponse trait from #175, allowing items implementing askama::Template to be returned directly from Gotham handlers, like so:

#[derive(Template)]
#[template(path = "hello.html")]
struct HelloTemplate<'a> {
    name: &'a str,
}

fn hello(state: State) -> (State, HelloTemplate<'static>) {
    (state, HelloTemplate { name: "world" })
}

fn main() {
    gotham::start("127.0.0.1:7878", || Ok(hello));
}

pub mod gotham {
extern crate gotham;
extern crate hyper;
extern crate mime_guess;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@djc In Rust 2018 we should not eliminate these extern crate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed them in the latest commit

@zzau13
Copy link
Contributor

zzau13 commented Dec 10, 2018

Can you compact it to a single commit?

It is a very good work. Thank you.

@kellenff kellenff closed this Dec 10, 2018
@kellenff kellenff deleted the rakenodiax/gotham branch December 10, 2018 20:34
@kellenff
Copy link
Contributor Author

I had an issue squashing the commits, and had to recreate the branch. I'll create another pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants