obsidian icon indicating copy to clipboard operation
obsidian copied to clipboard

Obsidian v0.3 Discussion

Open jk-gan opened this issue 5 years ago • 3 comments

Version 0.3 is about Evolution, we hope to improve DX and productivity by converting it from a micro-framework into rails/phoenix like framework. And this is the first step:

  • [ ] A cargo tool to generate project
  • [ ] Define the generated project structure #59
  • [ ] Improve router syntax
  • [ ] Websocket
  • [ ] Better error handling #61
  • [ ] Better console output
  • [ ] Prelude
  • [ ] Refine README #40
  • [ ] Documentation #35
  • [ ] Session cookies support #42
  • [ ] Handler mocking

jk-gan avatar Apr 24 '20 14:04 jk-gan

@jk-gan Just wondering, I tried following zero2prod for actix-web and I noticed that actix-web data extractor is not type-safe during compile time, it error out when I used the wrong data type at runtime. Looks like we have the same thing here, I am wondering if it would be good to explore that since we can probably guarantee that data during compile time?

pickfire avatar Sep 02 '20 15:09 pickfire

can u provide some examples?

jk-gan avatar Sep 05 '20 14:09 jk-gan

The example that I have is in actix-web.

// cargo add actix-web actix-rt
use actix_web::{web, App, HttpServer, Responder};

async fn greet(_data: web::Data<String>) -> impl Responder {
    "Hello world"
}

#[actix_rt::main]
async fn main() -> std::io::Result<()> {
    HttpServer::new(|| App::new().route("/", web::get().to(greet)))
        .bind("127.0.0.1:8000")?
        .run()
        .await
}

It compiles perfectly fine, but

> curl 127.1:8000
App data is not configured, to configure use App::data()

I am sure obsidian have the same issue since it have Context which is checked at runtime. Not sure if it's possible to be able to check it during compile time.

So far, I never know any framework that solves this. If obsidian can successfully tackle this, I think it would be cool.

pickfire avatar Sep 06 '20 03:09 pickfire