hapi.js
async function action_handler(req, h) {
    const data = req.payload
    const json = 'string' === typeof data ? tu.parseJSON(data) : data
    if (json instanceof Error) {
      throw json
    }

    const seneca = prepare_seneca(req, json)
    const msg = tu.internalize_msg(seneca, json)

    return await new Promise(resolve => {
      var out = null
      for (var i = 0; i < modify_action.length; i++) {
        out = modify_action[i].call(seneca, msg, req)
        if (out) {
          return resolve(out)
        }
      }

      seneca.act(msg, function(err, out, meta) {
        if (err && !options.debug) {
          err.stack = null
        }

        resolve(tu.externalize_reply(this, err, out, meta))
      })
    })
  }
async function action_handler(req, h) {
    const data = req.payload
    const json = 'string' === typeof data ? tu.parseJSON(data) : data
    if (json instanceof Error) {
      throw json
    }

    const seneca = prepare_seneca(req, json)
    const msg = tu.internalize_msg(seneca, json)

    return await new Promise(resolve => {
      var out = null
      for (var i = 0; i < modify_action.length; i++) {
        out = modify_action[i].call(seneca, msg, req)
        if (out) {
          return resolve(out)
        }
      }

      seneca.act(msg, function(err, out, meta) {
        if (err && !options.debug) {
          err.stack = null
        }

        resolve(tu.externalize_reply(this, err, out, meta))
      })
    })
  }
async function action_handler ( req , h ) { const data = req . payload const json = 'string' === typeof data ? tu . parseJSON ( data ) : data if ( json instanceof Error ) { throw json } const seneca = prepare_seneca ( req , json ) const msg = tu . internalize_msg ( seneca , json ) return await new Promise ( resolve => { var out = null for ( var i = 0 ; i < modify_action . length ; i ++ ) { out = modify_action [ i ] . call ( seneca , msg , req ) if ( out ) { return resolve ( out ) } } seneca . act ( msg , function ( err , out , meta ) { if ( err && ! options . debug ) { err . stack = null } resolve ( tu . externalize_reply ( this , err , out , meta ) ) } ) } ) }
Convenience handler to call a seneca action directly from inbound POST JSON.
Convenience handler to call a seneca action directly from inbound POST JSON .