Code Monkey home page Code Monkey logo

openfaas-rust-template's Introduction

OpenFaaS Rust Template - Abandoned

Please don't use this software, it's very out of date.

























here be dragons

This was featured in a blog post I wrote: https://booyaa.wtf/2018/run-rust-in-openfaas/

Usage

faas-cli template pull https://github.com/booyaa/openfaas-rust-template
faas-cli new trustinrust --lang rust

License

Observing the license used by OpenFaas, so this is licensed under the MIT License

openfaas-rust-template's People

Contributors

alechp avatar alexellis avatar booyaa 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

Watchers

 avatar

openfaas-rust-template's Issues

Implement a HTTP of-watchdog variant

Hi after the initial success of this template I want to suggest that you add another one to this repo with a suffix of http. The new template would use the new of-watchdog from OpenFaaS which allows for much high throughput by not forking a process for each request.

For an example see the openfaas-incubator org and the Go HTTP template.

Would you like to work on this or should I try to find another Rust developer to cover it? Thanks :)

Alex

How get HTML File?

I decided to try out Rust and OpenFaaS by rendering a needed HTML file. It seemed like I would need an HTTP client for that level of control, so I added hyper.

Results:

Compiling hyper v0.12.11
Compiling handler v0.1.0 (file:///usr/src/openfaas/function)
Compiling main v0.1.0 (file:///usr/src/openfaas/main)
error[E0277]: http::response::Response<hyper::body::body::Body> doesn't implement std::fmt::Display
--> src/main.rs:13:20
|
13 | println!("{}", handler::handle(buffer));
| ^^^^^^^^^^^^^^^^^^^^^^^ http::response::Response<hyper::body::body::Body> cannot be formatted with the default formatter
|
= help: the trait std::fmt::Display is not implemented for http::response::Response<hyper::body::body::Body>
= note: in format strings you may be able to use {:?} (or {:#?} for pretty-print) instead
= note: required by std::fmt::Display::fmt

error: aborting due to previous error

Question:

I understand that the request is handled for us, but don't we need to control the response in order to render HTML pages and return JSON?

How to change status codes?

Hey,

I found this template when I started playing with functions just the other day, and it's a nice setup so far. However, I can't figure out how to (if there is a way) to change the status code of a response, to indicate to the caller that the input is invalid or that something went wrong?

Cheers!

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.