Attributes
Includes Deno configuration
Repository
Current version released
2 years ago
Versions
why?doc
A simple API docs generator for simple APIs.
Hono)
Usage (example withImport:
// (will be published to deno.land/x soon, for now download and import the file)
Initialize:
const doc = WhyDoc({
title: "Test API Docs",
basePath: "/api", // optional
})
Then, instead of:
app.get(
"/test",
(c) => c.text("test"),
)
Do:
app.get(
doc("/test", "a simple test"), // returns the path to avoid repeating it
(c) => c.text("test"),
)
Add GET and POST Parameters:
app.post(
doc("/abc", "", {
postParams: {
name: "string",
},
}),
(c) => c.text("Done!"),
)
app.get(
doc("/xyz", "returns the 'name' GET parameter", {
getParams: {
name: "string",
},
}),
(c) => c.text(c.req.query("name")!),
)
Finally, generate the docs:
genDocs() // optionally, pass in a string path to a different output file
app.use("/docs", serveStatic({ path: "./docs.html" })) // serve the static html file however you want
And get something like:
License
GNU LGPLv3