How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • Boom.tooManyRequests('you have exceeded your request limit');
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">function</span> <span class="token generic-function"><span class="token function">tooManyRequests</span><span class="token generic class-name"><span class="token operator">&lt;</span><span class="token builtin">any</span><span class="token operator">></span></span></span><span class="token punctuation">(</span>message<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">,</span> data<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">)</span><span class="token operator">:</span> Boom<span class="token punctuation">.</span>Boom<span class="token operator">&lt;</span><span class="token builtin">any</span><span class="token operator">></span></code><div class="typing-tooltip-markup">Returns a 429 Too Many Requests error<br><br><em>@param</em> <code>message</code> — Optional message<br><br><em>@param</em> <code>data</code> — Optional additional error data<br><br><em>@returns</em> — A 429 Too Many Requests error</div></pre>
    Docs
    0
  • Boom.badRequest('invalid query');
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">function</span> <span class="token generic-function"><span class="token function">badRequest</span><span class="token generic class-name"><span class="token operator">&lt;</span><span class="token builtin">any</span><span class="token operator">></span></span></span><span class="token punctuation">(</span>message<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">,</span> data<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">)</span><span class="token operator">:</span> Boom<span class="token punctuation">.</span>Boom<span class="token operator">&lt;</span><span class="token builtin">any</span><span class="token operator">></span></code><div class="typing-tooltip-markup">Returns a 400 Bad Request error<br><br><em>@param</em> <code>message</code> — Optional message<br><br><em>@param</em> <code>data</code> — Optional additional error data<br><br><em>@returns</em> — A 400 bad request error</div></pre>
    Docs
    0
  • router
      .param('provider', (provider, ctx, next) => {
        if (!boolean(process.env[`AUTH_${provider.toUpperCase()}_ENABLED`])) {
          return ctx.throw(Boom.badRequest(ctx.translateError('INVALID_PROVIDER')));
        }
    
        return next();
      })
      
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> router<span class="token operator">:</span> Router<span class="token operator">&lt;</span>Application<span class="token punctuation">.</span>DefaultState<span class="token punctuation">,</span> Application<span class="token punctuation">.</span>DefaultContext<span class="token operator">></span></code></pre>
    /ladjs/lad mit
    0
  • async function setup(ctx) {
      
      //...
    if (ctx.state.user[config.userFields.hasSetPassword]) {
        if (!isSANB(body.password))
          throw Boom.badRequest(ctx.translateError('INVALID_PASSWORD'));
    
        const { user } = await ctx.state.user.authenticate(body.password);
        if (!user) throw Boom.badRequest(ctx.translateError('INVALID_PASSWORD'));
      }
    
      
    
      //...
    }
    
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">function</span> <span class="token function">setup</span><span class="token punctuation">(</span><span class="token parameter">ctx<span class="token operator">:</span> any</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">Promise</span><span class="token operator">&lt;</span><span class="token builtin">any</span><span class="token operator">></span></code></pre>
    /ladjs/lad mit
    0
  • async function disable(ctx) {
      
      //...
    if (!ctx.state.user[config.passport.fields.otpEnabled])
        throw Boom.badRequest(ctx.translateError('TWO_FACTOR_REQUIRED'));
    
      if (ctx.state.user[config.userFields.hasSetPassword]) {
        if (!isSANB(body.password))
          throw Boom.badRequest(ctx.translateError('INVALID_PASSWORD'));
    
        const { user } = await ctx.state.user.authenticate(body.password);
        if (!user) throw Boom.badRequest(ctx.translateError('INVALID_PASSWORD'));
      }
    
      
    
      //...
    }
    
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">function</span> <span class="token function">disable</span><span class="token punctuation">(</span><span class="token parameter">ctx<span class="token operator">:</span> any</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">Promise</span><span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token operator">></span></code></pre>
    /ladjs/lad mit
    0
  • Boom.isBoom(Boom.badRequest()); // true
    Boom.isBoom(Boom.badRequest(), 400); // true
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">function</span> <span class="token function">isBoom</span><span class="token punctuation">(</span><span class="token parameter">obj<span class="token operator">:</span> unknown<span class="token punctuation">,</span> statusCode<span class="token operator">?</span><span class="token operator">:</span> number</span><span class="token punctuation">)</span><span class="token operator">:</span> obj <span class="token keyword">is</span> Boom<span class="token punctuation">.</span>Boom<span class="token operator">&lt;</span><span class="token builtin">any</span><span class="token operator">></span></code><div class="typing-tooltip-markup">Specifies if an object is a valid boom object<br><br><em>@param</em> <code>obj</code> — The object to assess<br><br><em>@param</em> <code>statusCode</code> — Optional status code<br><br><em>@returns</em> — Returns a boolean stating if the error object is a valid boom object and it has the provided statusCode (if present)</div></pre>
    Docs
    0
  • Boom.clientTimeout('timed out');
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">function</span> <span class="token generic-function"><span class="token function">clientTimeout</span><span class="token generic class-name"><span class="token operator">&lt;</span><span class="token builtin">any</span><span class="token operator">></span></span></span><span class="token punctuation">(</span>message<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">,</span> data<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">)</span><span class="token operator">:</span> Boom<span class="token punctuation">.</span>Boom<span class="token operator">&lt;</span><span class="token builtin">any</span><span class="token operator">></span></code><div class="typing-tooltip-markup">Returns a 408 Request Time-out error<br><br><em>@param</em> <code>message</code> — Optional message<br><br><em>@param</em> <code>data</code> — Optional additional error data<br><br><em>@returns</em> — A 408 Request Time-out error</div></pre>
    Docs
    0
  • Boom.failedDependency('an external resource failed');
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">function</span> <span class="token generic-function"><span class="token function">failedDependency</span><span class="token generic class-name"><span class="token operator">&lt;</span><span class="token builtin">any</span><span class="token operator">></span></span></span><span class="token punctuation">(</span>message<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">,</span> data<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">)</span><span class="token operator">:</span> Boom<span class="token punctuation">.</span>Boom<span class="token operator">&lt;</span><span class="token builtin">any</span><span class="token operator">></span></code><div class="typing-tooltip-markup">Returns a 424 Failed Dependency error<br><br><em>@param</em> <code>message</code> — Optional message<br><br><em>@param</em> <code>data</code> — Optional additional error data<br><br><em>@returns</em> — A 424 Failed Dependency error</div></pre>
    Docs
    0
  • Boom.badImplementation('terrible implementation');
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">function</span> <span class="token generic-function"><span class="token function">badImplementation</span><span class="token generic class-name"><span class="token operator">&lt;</span><span class="token builtin">any</span><span class="token operator">></span></span></span><span class="token punctuation">(</span>message<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">,</span> data<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">)</span><span class="token operator">:</span> Boom<span class="token punctuation">.</span>Boom<span class="token operator">&lt;</span><span class="token builtin">any</span><span class="token operator">></span></code><div class="typing-tooltip-markup">Returns a 500 Internal Server Error error<br><br><em>@param</em> <code>message</code> — Optional message<br><br><em>@param</em> <code>data</code> — Optional additional error data<br><br><em>@returns</em> — A 500 Internal Server error</div></pre>
    Docs
    0
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples