Skip to content

Feature

poteto edited this page Nov 21, 2024 · 4 revisions

Feature of poteto API

RequestId

Version

It requires >=0.19.0.

How to use

You can get or generate RequestId from context.

  • You can log easily.
func handler(ctx poteto.Context) error {
  reqId := ctx.RequestId()
  your_logger(reqId)
}
  • The Response will be include X-Request-Id.

Algo

  1. Get from Context.store This makes faster if many time access. If you access to requestId in handler, You get from Context.store
  2. Get from Header X-Request-Id.
  3. Gen UUID@v4.

Feature of Algo (almost all Framework do)

Router uses TrieTree

Router uses TrieTree. Node's key is split by "/".

ex) /user/profile/:id -> (user) => (profile) => (:id)

  • TrieTree

https://medium.com/@gwt200407/data-structure-trie-tree-ea5c9be38a74

Using cache of context

Cached context for the second and subsequent requests. it requires >=0.14.0.

Clone this wiki locally