Nucleus Powered Mitochondria

    peekinto

    0.0.5 • Public • Published

    Peek into a request

    app.peek.get '/users/:name/**'(req, res) ->
        res.locals.user = loaduser req.query.name
     
    app.get '/users/:name/dashboard'(req, res) ->
        res.locals.latestprojects = getlatestprojects res.locals.user
        res.render 'dashboard'

    What is the problem?

    A web request can be thought of as a pipeline. To render a given request multiple modules may have contributed to the content. The output of each module may be a rendered template or the results of an intermediate query. To finish off all the content and values are collected and rendered into the destination template.

    How peekinto solves this problem

    1. Peekinto adds an additional structure to the express application object called peek. This has the same verb registration methods - get, post, put, delete.
    2. Methods registered against these verbs are not expected to complete the request.
    3. Multiple methods can match the same request, each getting an opportunity to perform processing.
    4. After all peek methods are run the normal app.VERB methods are called.

    Goals

    1. Simple
    2. Work with existing code
    3. Support UI composition

    Keywords

    none

    Install

    npm i peekinto

    DownloadsWeekly Downloads

    2

    Version

    0.0.5

    License

    none

    Last publish

    Collaborators

    • tcoats
    • tornadot-tim