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

  • const http = require('http');
    const https = require('https');
    const Koa = require('koa');
    const app = new Koa();
    http.createServer(app.callback()).listen(3000);
    https.createServer(app.callback()).listen(3001);
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">module</span> <span class="token string">"http"</span> <span class="token keyword">import</span> http</code><div class="typing-tooltip-markup">To use the HTTP server and client one must <code>require('http')</code>.<br><br>The HTTP interfaces in Node.js are designed to support many features of the protocol which have been traditionally difficult to use. In particular, large, possibly chunk-encoded, messages. The interface is careful to never buffer entire requests or responses, so the user is able to stream data.<br><br>HTTP message headers are represented by an object like this:<br><br><pre class="code js"><code class="language-js">{ 'content-length': '123', 'content-type': 'text/plain', 'connection': 'keep-alive', 'host': 'mysite.com', 'accept': '*' }</code></pre><br><br>Keys are lowercased. Values are not modified.<br><br>In order to support the full spectrum of possible HTTP applications, the Node.js HTTP API is very low-level. It deals with stream handling and message parsing only. It parses a message into headers and body but it does not parse the actual headers or the body.<br><br>See <code>message.headers</code> for details on how duplicate headers are handled.<br><br>The raw headers as they were received are retained in the <code>rawHeaders</code>property, which is an array of <code>[key, value, key2, value2, ...]</code>. For example, the previous message header object might have a <code>rawHeaders</code>list like the following:<br><br><pre class="code js"><code class="language-js">[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'mysite.com', 'accepT', '*' ]</code></pre><br><br><em>@see</em> — <a href="https://github.com/nodejs/node/blob/v16.9.0/lib/http.js">source</a></div></pre>
    Docs
    1
  • //...
    const http = require('http');
    const Koa = require('koa');
    const body = require('../index');
    
    const app = new Koa()
    
    app.use(body())
    
    app.use(async (ctx, next) => {
      ctx.body = ctx.request.body || 'no body!';
      await next();
    });
    
    module.exports = http.createServer(app.callback());
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">module</span> <span class="token string">"http"</span> <span class="token keyword">import</span> http</code><div class="typing-tooltip-markup">To use the HTTP server and client one must <code>require('http')</code>.<br><br>The HTTP interfaces in Node.js are designed to support many features of the protocol which have been traditionally difficult to use. In particular, large, possibly chunk-encoded, messages. The interface is careful to never buffer entire requests or responses, so the user is able to stream data.<br><br>HTTP message headers are represented by an object like this:<br><br><pre class="code js"><code class="language-js">{ 'content-length': '123', 'content-type': 'text/plain', 'connection': 'keep-alive', 'host': 'mysite.com', 'accept': '*' }</code></pre><br><br>Keys are lowercased. Values are not modified.<br><br>In order to support the full spectrum of possible HTTP applications, the Node.js HTTP API is very low-level. It deals with stream handling and message parsing only. It parses a message into headers and body but it does not parse the actual headers or the body.<br><br>See <code>message.headers</code> for details on how duplicate headers are handled.<br><br>The raw headers as they were received are retained in the <code>rawHeaders</code>property, which is an array of <code>[key, value, key2, value2, ...]</code>. For example, the previous message header object might have a <code>rawHeaders</code>list like the following:<br><br><pre class="code js"><code class="language-js">[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'mysite.com', 'accepT', '*' ]</code></pre><br><br><em>@see</em> — <a href="https://github.com/nodejs/node/blob/v16.9.0/lib/http.js">source</a><br><br><em>@see</em> — <a href="https://github.com/nodejs/node/blob/v16.9.0/lib/http.js">source</a></div></pre>
    /xiongwilee/Gracejs mit
    0
  • const http = require('http');
    const Koa = require('koa');
    const app = new Koa();
    http.createServer(app.callback()).listen(3000);
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">module</span> <span class="token string">"http"</span> <span class="token keyword">import</span> http</code><div class="typing-tooltip-markup">To use the HTTP server and client one must <code>require('http')</code>.<br><br>The HTTP interfaces in Node.js are designed to support many features of the protocol which have been traditionally difficult to use. In particular, large, possibly chunk-encoded, messages. The interface is careful to never buffer entire requests or responses, so the user is able to stream data.<br><br>HTTP message headers are represented by an object like this:<br><br><pre class="code js"><code class="language-js">{ 'content-length': '123', 'content-type': 'text/plain', 'connection': 'keep-alive', 'host': 'mysite.com', 'accept': '*' }</code></pre><br><br>Keys are lowercased. Values are not modified.<br><br>In order to support the full spectrum of possible HTTP applications, the Node.js HTTP API is very low-level. It deals with stream handling and message parsing only. It parses a message into headers and body but it does not parse the actual headers or the body.<br><br>See <code>message.headers</code> for details on how duplicate headers are handled.<br><br>The raw headers as they were received are retained in the <code>rawHeaders</code>property, which is an array of <code>[key, value, key2, value2, ...]</code>. For example, the previous message header object might have a <code>rawHeaders</code>list like the following:<br><br><pre class="code js"><code class="language-js">[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'mysite.com', 'accepT', '*' ]</code></pre><br><br><em>@see</em> — <a href="https://github.com/nodejs/node/blob/v16.9.0/lib/http.js">source</a></div></pre>
    Docs
    0
  • //...
    // routes
    app.use(index.routes(), index.allowedMethods())
    app.use(users.routes(), users.allowedMethods())
    
    // error-handling
    app.on('error', (err, ctx) => {
      console.error('server error', err, ctx)
    });
    
    module.exports = app
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> app<span class="token operator">:</span> Koa<span class="token operator">&lt;</span>Koa<span class="token punctuation">.</span>DefaultState<span class="token punctuation">,</span> Koa<span class="token punctuation">.</span>DefaultContext<span class="token operator">></span></code></pre>
    /TencentCloudBase/cloudbase-templates apache-2.0
    0
  • app.on('error', err => {
      log.error('server error', err)
    });
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>method<span class="token punctuation">)</span> EventEmitter<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span>emitter<span class="token operator">:</span> NodeJS<span class="token punctuation">.</span>EventEmitter<span class="token punctuation">,</span> eventName<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">,</span> options<span class="token operator">?</span><span class="token operator">:</span> StaticEventEmitterOptions<span class="token punctuation">)</span><span class="token operator">:</span> AsyncIterableIterator<span class="token operator">&lt;</span><span class="token builtin">any</span><span class="token operator">></span></code><div class="typing-tooltip-markup"><pre class="code js"><code class="language-js">const { on, EventEmitter } = require('events'); (async () =&gt; { const ee = new EventEmitter(); // Emit later on process.nextTick(() =&gt; { ee.emit('foo', 'bar'); ee.emit('foo', 42); }); for await (const event of on(ee, 'foo')) { // The execution of this inner block is synchronous and it // processes one event at a time (even with await). Do not use // if concurrent execution is required. console.log(event); // prints ['bar'] [42] } // Unreachable here })();</code></pre><br><br>Returns an <code>AsyncIterator</code> that iterates <code>eventName</code> events. It will throw if the <code>EventEmitter</code> emits <code>'error'</code>. It removes all listeners when exiting the loop. The <code>value</code> returned by each iteration is an array composed of the emitted event arguments.<br><br>An <code>AbortSignal</code> can be used to cancel waiting on events:<br><br><pre class="code js"><code class="language-js">const { on, EventEmitter } = require('events'); const ac = new AbortController(); (async () =&gt; { const ee = new EventEmitter(); // Emit later on process.nextTick(() =&gt; { ee.emit('foo', 'bar'); ee.emit('foo', 42); }); for await (const event of on(ee, 'foo', { signal: ac.signal })) { // The execution of this inner block is synchronous and it // processes one event at a time (even with await). Do not use // if concurrent execution is required. console.log(event); // prints ['bar'] [42] } // Unreachable here })(); process.nextTick(() =&gt; ac.abort());</code></pre><br><br><em>@since</em> — v13.6.0, v12.16.0<br><br><em>@param</em> <code>eventName</code> — The name of the event being listened for<br><br><em>@return</em> — that iterates <code>eventName</code> events emitted by the <code>emitter</code></div></pre>
    Docs
    0
  • //...
    app.on('error', (err, ctx) => {
      if (!err.status || err.status >= 500) {
        Sentry.withScope(function(scope) {
          scope.addEventProcessor(function(event) {
            return Sentry.Handlers.parseRequest(event, ctx.request); 
          });
          Sentry.captureException(err);
          debug(err);
        });
      }
    });
    
    
    
    //...
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> app<span class="token operator">:</span> koa<span class="token operator">&lt;</span>koa<span class="token punctuation">.</span>DefaultState<span class="token punctuation">,</span> koa<span class="token punctuation">.</span>DefaultContext<span class="token operator">></span></code></pre>
    /kudos/combine.fm MIT
    0
  • //...
    app.use(helmet());
    app.use(
      cors({
        credentials: true
      })
    );
    app.use(body());
    app.use(router.routes());
    app.on('error', (err, ctx) => {
      console.error('server error', err, ctx);
    });
    
    export default app;
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> app<span class="token operator">:</span> Koa<span class="token operator">&lt;</span>Koa<span class="token punctuation">.</span>DefaultState<span class="token punctuation">,</span> Koa<span class="token punctuation">.</span>DefaultContext<span class="token operator">></span></code></pre>
    /JasKang/ears-client mit
    0
  • app.on('error', (err, ctx) => {
      log.error('server error', err, ctx)
    });
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>method<span class="token punctuation">)</span> EventEmitter<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span>emitter<span class="token operator">:</span> NodeJS<span class="token punctuation">.</span>EventEmitter<span class="token punctuation">,</span> eventName<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">,</span> options<span class="token operator">?</span><span class="token operator">:</span> StaticEventEmitterOptions<span class="token punctuation">)</span><span class="token operator">:</span> AsyncIterableIterator<span class="token operator">&lt;</span><span class="token builtin">any</span><span class="token operator">></span></code><div class="typing-tooltip-markup"><pre class="code js"><code class="language-js">const { on, EventEmitter } = require('events'); (async () =&gt; { const ee = new EventEmitter(); // Emit later on process.nextTick(() =&gt; { ee.emit('foo', 'bar'); ee.emit('foo', 42); }); for await (const event of on(ee, 'foo')) { // The execution of this inner block is synchronous and it // processes one event at a time (even with await). Do not use // if concurrent execution is required. console.log(event); // prints ['bar'] [42] } // Unreachable here })();</code></pre><br><br>Returns an <code>AsyncIterator</code> that iterates <code>eventName</code> events. It will throw if the <code>EventEmitter</code> emits <code>'error'</code>. It removes all listeners when exiting the loop. The <code>value</code> returned by each iteration is an array composed of the emitted event arguments.<br><br>An <code>AbortSignal</code> can be used to cancel waiting on events:<br><br><pre class="code js"><code class="language-js">const { on, EventEmitter } = require('events'); const ac = new AbortController(); (async () =&gt; { const ee = new EventEmitter(); // Emit later on process.nextTick(() =&gt; { ee.emit('foo', 'bar'); ee.emit('foo', 42); }); for await (const event of on(ee, 'foo', { signal: ac.signal })) { // The execution of this inner block is synchronous and it // processes one event at a time (even with await). Do not use // if concurrent execution is required. console.log(event); // prints ['bar'] [42] } // Unreachable here })(); process.nextTick(() =&gt; ac.abort());</code></pre><br><br><em>@since</em> — v13.6.0, v12.16.0<br><br><em>@param</em> <code>eventName</code> — The name of the event being listened for<br><br><em>@return</em> — that iterates <code>eventName</code> events emitted by the <code>emitter</code></div></pre>
    Docs
    0
  • const http = require('http');
    const https = require('https');
    const Koa = require('koa');
    const app = new Koa();
    http.createServer(app.callback()).listen(3000);
    https.createServer(app.callback()).listen(3001);
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">module</span> <span class="token string">"http"</span> <span class="token keyword">import</span> http</code><div class="typing-tooltip-markup">To use the HTTP server and client one must <code>require('http')</code>.<br><br>The HTTP interfaces in Node.js are designed to support many features of the protocol which have been traditionally difficult to use. In particular, large, possibly chunk-encoded, messages. The interface is careful to never buffer entire requests or responses, so the user is able to stream data.<br><br>HTTP message headers are represented by an object like this:<br><br><pre class="code js"><code class="language-js">{ 'content-length': '123', 'content-type': 'text/plain', 'connection': 'keep-alive', 'host': 'mysite.com', 'accept': '*' }</code></pre><br><br>Keys are lowercased. Values are not modified.<br><br>In order to support the full spectrum of possible HTTP applications, the Node.js HTTP API is very low-level. It deals with stream handling and message parsing only. It parses a message into headers and body but it does not parse the actual headers or the body.<br><br>See <code>message.headers</code> for details on how duplicate headers are handled.<br><br>The raw headers as they were received are retained in the <code>rawHeaders</code>property, which is an array of <code>[key, value, key2, value2, ...]</code>. For example, the previous message header object might have a <code>rawHeaders</code>list like the following:<br><br><pre class="code js"><code class="language-js">[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'mysite.com', 'accepT', '*' ]</code></pre><br><br><em>@see</em> — <a href="https://github.com/nodejs/node/blob/v16.9.0/lib/http.js">source</a></div></pre>
    Docs
    1
  • var conditional = require('koa-conditional-get');
    var etag = require('koa-etag');
    var koa = require('koa');
    var app = koa();
    
    module.exports = function(app) {
      app.use(conditional());
      app.use(etag());
    }
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">conditional</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">Function</span> <span class="token keyword">import</span> conditional</code><div class="typing-tooltip-markup">Conditional GET support middleware.<br><br><em>@return</em><br><br><em>@api</em> — public</div></pre>
    /jbielick/kona MIT
    0
  • const http = require('http');
    const Koa = require('koa');
    const app = new Koa();
    http.createServer(app.callback()).listen(3000);
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">module</span> <span class="token string">"http"</span> <span class="token keyword">import</span> http</code><div class="typing-tooltip-markup">To use the HTTP server and client one must <code>require('http')</code>.<br><br>The HTTP interfaces in Node.js are designed to support many features of the protocol which have been traditionally difficult to use. In particular, large, possibly chunk-encoded, messages. The interface is careful to never buffer entire requests or responses, so the user is able to stream data.<br><br>HTTP message headers are represented by an object like this:<br><br><pre class="code js"><code class="language-js">{ 'content-length': '123', 'content-type': 'text/plain', 'connection': 'keep-alive', 'host': 'mysite.com', 'accept': '*' }</code></pre><br><br>Keys are lowercased. Values are not modified.<br><br>In order to support the full spectrum of possible HTTP applications, the Node.js HTTP API is very low-level. It deals with stream handling and message parsing only. It parses a message into headers and body but it does not parse the actual headers or the body.<br><br>See <code>message.headers</code> for details on how duplicate headers are handled.<br><br>The raw headers as they were received are retained in the <code>rawHeaders</code>property, which is an array of <code>[key, value, key2, value2, ...]</code>. For example, the previous message header object might have a <code>rawHeaders</code>list like the following:<br><br><pre class="code js"><code class="language-js">[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'mysite.com', 'accepT', '*' ]</code></pre><br><br><em>@see</em> — <a href="https://github.com/nodejs/node/blob/v16.9.0/lib/http.js">source</a></div></pre>
    Docs
    0
  • const Koa = require('koa');
    const app = new Koa();
    app.listen(3000);
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">class</span> <span class="token class-name">Koa<span class="token operator">&lt;</span>StateT <span class="token operator">=</span> Application<span class="token punctuation">.</span>DefaultState<span class="token punctuation">,</span> ContextT <span class="token operator">=</span> Application<span class="token punctuation">.</span>DefaultContext<span class="token operator">></span></span> <span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">namespace</span> Koa <span class="token keyword">import</span> Koa</code></pre>
    Docs
    0
  • const Koa = require('koa');
    const app = new Koa();
    
    // logger
    
    app.use(async (ctx, next) => {
      await next();
      const rt = ctx.response.get('X-Response-Time');
      console.log(`${ctx.method} ${ctx.url} - ${rt}`);
    });
    
    // x-response-time
    
    app.use(async (ctx, next) => {
      const start = Date.now();
      await next();
      const ms = Date.now() - start;
      ctx.set('X-Response-Time', `${ms}ms`);
    });
    
    // response
    
    app.use(async ctx => {
      ctx.body = 'Hello World';
    });
    
    app.listen(3000);
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">class</span> <span class="token class-name">Koa<span class="token operator">&lt;</span>StateT <span class="token operator">=</span> Application<span class="token punctuation">.</span>DefaultState<span class="token punctuation">,</span> ContextT <span class="token operator">=</span> Application<span class="token punctuation">.</span>DefaultContext<span class="token operator">></span></span> <span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">namespace</span> Koa <span class="token keyword">import</span> Koa</code></pre>
    Docs
    0
  • //...
    /**
     * Let's redirect to `/login` after every response.
     * If a user hits `/logout` when they're already logged out,
     * let's not consider that an error and rather a "success".
     */
    app.use(async (ctx, next) => {
      if (ctx.path !== '/logout') return await next();
      ctx.session.authenticated = false;
      ctx.redirect('/login');
    });
    
    app.listen(process.argv[2]);
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">module</span> app <span class="token keyword">const</span> app<span class="token operator">:</span> Koa<span class="token operator">&lt;</span>Koa<span class="token punctuation">.</span>DefaultState<span class="token punctuation">,</span> Koa<span class="token punctuation">.</span>DefaultContext<span class="token operator">></span></code></pre>
    /koajs/kick-off-koa MIT
    0
  • //...
    app.use(ctx => {
      ctx.body = 'Hello Koa';
    });
    app.listen(3000);
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> app<span class="token operator">:</span> Koa<span class="token operator">&lt;</span>Koa<span class="token punctuation">.</span>DefaultState<span class="token punctuation">,</span> Koa<span class="token punctuation">.</span>DefaultContext<span class="token operator">></span></code></pre>
    /huo-ju/mixin-node mit
    0
  • //...
    const app = new Koa();
    
    app.use(contextFactory.getKoaMiddleware());
    
    app.use(async (ctx) => {
      contextFactory.setOnContext('customer_id', Math.round(Math.random() * 1000));
    
      console.log(contextFactory.getContextStorage());
    
      ctx.body = 'It works';
    });
    
    app.listen(port);
    console.log('listening on port: ' + port);
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> app<span class="token operator">:</span> Koa<span class="token operator">&lt;</span>Koa<span class="token punctuation">.</span>DefaultState<span class="token punctuation">,</span> Koa<span class="token punctuation">.</span>DefaultContext<span class="token operator">></span></code></pre>
    /emartech/cls-adapter mit
    0
  • const Koa = require('koa');
    const app = new Koa();
    app.listen(3000);
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">class</span> <span class="token class-name">Koa<span class="token operator">&lt;</span>StateT <span class="token operator">=</span> Application<span class="token punctuation">.</span>DefaultState<span class="token punctuation">,</span> ContextT <span class="token operator">=</span> Application<span class="token punctuation">.</span>DefaultContext<span class="token operator">></span></span> <span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">namespace</span> Koa <span class="token keyword">import</span> Koa</code></pre>
    Docs
    0
  • const Koa = require('koa');
    const app = new Koa();
    
    app.use(async ctx => {
      ctx.body = 'Hello World';
    });
    
    app.listen(3000);
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">class</span> <span class="token class-name">Koa<span class="token operator">&lt;</span>StateT <span class="token operator">=</span> Application<span class="token punctuation">.</span>DefaultState<span class="token punctuation">,</span> ContextT <span class="token operator">=</span> Application<span class="token punctuation">.</span>DefaultContext<span class="token operator">></span></span> <span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">namespace</span> Koa <span class="token keyword">import</span> Koa</code></pre>
    Docs
    0
  • const url = Router.url('/users/:id', {id: 1});
    // => "/users/1"
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> url<span class="token operator">:</span> <span class="token builtin">string</span></code></pre>
    Docs
    0
  • router.get('user', '/users/:id', (ctx, next) => {
     // ...
    });
    
    router.url('user', 3);
    // => "/users/3"
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token builtin">any</span></code></pre>
    Docs
    0
  • router.get('user', '/users/:id', (ctx, next) => {
      // ...
    });
    
    router.url('user', 3);
    // => "/users/3"
    
    router.url('user', { id: 3 });
    // => "/users/3"
    
    router.use((ctx, next) => {
      // redirect to named route
      ctx.redirect(ctx.router.url('sign-in'));
    })
    
    router.url('user', { id: 3 }, { query: { limit: 1 } });
    // => "/users/3?limit=1"
    
    router.url('user', { id: 3 }, { query: "limit=1" });
    // => "/users/3?limit=1"
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token builtin">any</span></code></pre>
    Docs
    0
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples