obsidian-rs / obsidian

Ergonomic async http framework for reliable and efficient web
MIT License
26 stars 4 forks source link

Feature/endpoint redesign #48

Closed plwai closed 4 years ago

plwai commented 4 years ago

Redesign http request response flow

related #44 resolve #47

plwai commented 4 years ago

@jk-gan Any idea for the context build? This is the only way I can think of now. &mut ctx is not possible because of the async future lifetime. If we do not return ctx, then the ctx data will be lost.

Possible approach:

  1. ctx.build like current implementation.

  2. let user to assign all of the data again in response.

  3. abandon context approach, rewrite all the flow.

jk-gan commented 4 years ago

I think that ctx.build() is not so clear on what the code is doing. Maybe we can use something like ctx.respond() or ctx.resp.build() 🤔

plwai commented 4 years ago

Totally agree. My intention to use the ctx.build is just temporary to resolve the blocker only. We need to decide a naming for it.

jk-gan commented 4 years ago

I'm thinking other approaches besides this context pattern for the new structure, but so far so good

plwai commented 4 years ago

I'm thinking other approaches besides this context pattern for the new structure, but so far so good

Ya. We should try to explore more approaches.