Giter VIP home page Giter VIP logo

prismy's Issues

Aliases for ResponseObject type

ResponseObject<T> is quite long and can make code a bit cumbersome expecially as it is very often wrapped with Promise like Promise<ResponseObject<ApiResponseBody>>.

It may be nice to have a shorter alias for ResponseObject and maybe a something like AsyncResponse for use with async handlers to help reduce code clutter.

Middleware

To use session, I think we need to introduce middleware. So I'm thinking that we would need middleware decorators, @before and @after.

@before will be called right before run execute method of a handler.
@after will be called right after ...

Gif showcase

It would be nice to show how prismy improve DX with GIF.

Redirection

We need redirectResult and redirect method for BaseHandler

Tuple types is not resolved properly when multiple arguments are injected

Expected

const numberSelector: Selector<number> = ...
const stringSelector: Selector<string> = ...

const handler = prismy([numberSelector, stringSelector], (numberValue, stringValue) => {
  ...
})

Typescrirpt should recognize the tuple, [number, string].

Current status

Typescript infers the type as (number | string )[]

Renew APIs

To use parameter decorators, we're using class. But I think it is kind of annoying... I guess we could do like the below example.

myHandler.selectors = [Session()]
function myHandler(session: SessionState) {
  
}

export default prismy(myHandler)

Improve body selectors

  • Throw an error if req.body exists for bufferBodySelector, textBodySelector, jsonBodySelector and urlEncodedBody.
  • Introduce general bodySelector which behaves just like next.js's body parsing behavior.

Prepare live examples

The power of prismy can be aware when adopters are using it actually in VSCode.

I guess hosting some examples in Codesandbox should be enough!

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.