From 3ccc0f7ba2b72538c5eaab5e38fccc8484cf8c4a Mon Sep 17 00:00:00 2001 From: ZYSzys <17367077526@163.com> Date: Sat, 27 Oct 2018 13:54:35 +0800 Subject: [PATCH] chore: add table of contents for guide.md --- docs/guide.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/guide.md b/docs/guide.md index 4a763ea5d..e13dde95c 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -3,6 +3,17 @@ This guide covers Koa topics that are not directly API related, such as best practices for writing middleware and application structure suggestions. In these examples we use async functions as middleware - you can also use commonFunction or generatorFunction which will be a little different. +## Table of Contents + +- [Writing Middleware](#writing-middleware) +- [Middleware Best Practices](#middleware-best-practices) + - [Middleware options](#middleware-options) + - [Named middleware](#named-middleware) + - [Combining multiple middleware with koa-compose](#combining-multiple-middleware-with-koa-compose) + - [Response Middleware](#response-middleware) +- [Async operations](#async-operations) +- [Debugging Koa](#debugging-koa) + ## Writing Middleware Koa middleware are simple functions which return a `MiddlewareFunction` with signature (ctx, next). When @@ -123,8 +134,6 @@ const all = compose([random, backwards, pi]); app.use(all); ``` - - ### Response Middleware Middleware that decide to respond to a request and wish to bypass downstream middleware may