Skip to content

Golang project to read Koa.js routes and build the skeleton of a Slate document.

Notifications You must be signed in to change notification settings

kratos-42/initial-slate-structure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

initial-slate-structure

Tracking and documenting an API endpoints can be an hard task, especially when it start growing. This Go package aims to create an initial structure for documenting an API using Slate (.md format).

This package is supposed to work along with another script I built:

  • The bash script reads from the project modules, outputting a file with a list of routes and related middlewares;
  • This Go package, reads from the previous output file and generates a documentation skeleton for the provided API routes.

Handling middlewares

Considering each middleware may have different structure and arguments, we need to especially handle one by one. To do so, we just need to had the name of the middleware to the switch case in storage/write_date and add the desired template for it in storage/templates.

Here is the list of the middlewares names already being handled:

  • include
  • sort
  • filter
  • paginate
  • authorization

Input document example

GET /countries/:id authorization
GET /countries authorization sort filter include
POST /countries

Output page example

Page example

Usage

go run main.go inputFilename [outputFilename]

Arguments

  • inputFilename: File containing the list of endpoints, one per line
  • ouputFilename: Name of the result file. If one is not provided, the result filename is the current directory.

About

Golang project to read Koa.js routes and build the skeleton of a Slate document.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages