All Projects → SurveyLegend → hapi-docs

SurveyLegend / hapi-docs

Licence: MIT license
Beautiful API documentation generator for Hapi using Vue

Programming Languages

Vue
7211 projects
javascript
184084 projects - #8 most used programming language
SCSS
7915 projects

Projects that are alternatives of or similar to hapi-docs

hapi-good-winston
A good reporter to send and log events with winston
Stars: ✭ 21 (-67.19%)
Mutual labels:  hapi, hapi-plugin
hapi-plugin-mysql
Hapi plugin for MySQL
Stars: ✭ 17 (-73.44%)
Mutual labels:  hapi, hapi-plugin
hapi-statsd
A hapi plugin for sending request round trip metrics to statsd
Stars: ✭ 29 (-54.69%)
Mutual labels:  hapi, hapi-plugin
hapi-now-auth
Hapi token auth for bearer and jwt
Stars: ✭ 43 (-32.81%)
Mutual labels:  hapi, hapi-plugin
hapi-mongo-models
📦 A hapi plugin for `mongo-models`
Stars: ✭ 101 (+57.81%)
Mutual labels:  hapi, hapi-plugin
hapi-sequelizejs
A hapi.js plugin to connect with Sequelize ORM
Stars: ✭ 56 (-12.5%)
Mutual labels:  hapi, hapi-plugin
hapi-sentry
A hapi plugin for request error logging to Sentry
Stars: ✭ 24 (-62.5%)
Mutual labels:  hapi, hapi-plugin
hapi-dev-errors
A hapi plugin to return better error details and skip the look at command line to catch the issue.
Stars: ✭ 58 (-9.37%)
Mutual labels:  hapi, hapi-plugin
Node Rate Limiter Flexible
Node.js rate limit requests by key with atomic increments in single process or distributed environment.
Stars: ✭ 1,950 (+2946.88%)
Mutual labels:  hapi
Cls Rtracer
Request Tracer - CLS-based request id generation for Express, Fastify, Koa and Hapi, batteries included
Stars: ✭ 175 (+173.44%)
Mutual labels:  hapi
Aither
An example microservice system in Node.js using Hemera and best of today.
Stars: ✭ 116 (+81.25%)
Mutual labels:  hapi
Electrode Csrf Jwt
Stateless Cross-Site Request Forgery (CSRF) protection with JWT
Stars: ✭ 127 (+98.44%)
Mutual labels:  hapi
Hapijs.com
The hapijs.com website
Stars: ✭ 181 (+182.81%)
Mutual labels:  hapi
Node Frameworks Benchmark
Simple HTTP benchmark for different nodejs frameworks using wrk
Stars: ✭ 117 (+82.81%)
Mutual labels:  hapi
Openapi Backend
Build, Validate, Route, Authenticate and Mock using OpenAPI
Stars: ✭ 216 (+237.5%)
Mutual labels:  hapi
Real World Grading App
An example of a real-world REST API backend built with TypeScript, Hapi, Prisma, and PostgreSQL.
Stars: ✭ 105 (+64.06%)
Mutual labels:  hapi
Aqua
💡 A website and user system starter
Stars: ✭ 1,391 (+2073.44%)
Mutual labels:  hapi
Hapi React Views
📦 A hapi view engine for React components
Stars: ✭ 234 (+265.63%)
Mutual labels:  hapi
Hapi Universal Redux
DEPRECATED: Create an universal React and Redux app in less than 5 minutes!
Stars: ✭ 215 (+235.94%)
Mutual labels:  hapi
Hapi Api
Lean hapi API Boilerplate with an opinionated view on project structure
Stars: ✭ 148 (+131.25%)
Mutual labels:  hapi

npm downloads MIT license

Introduction

hapi-docs is perhaps the best and most modern API Documentation Generator out there. From your code blocks to description texts, you simply type everything in Markdown. Then all you need to do is to enjoy a blazing fast single-page responsive documentation, which smartly supports linkability, Syntax highlighting, RTL languages, and perfectionist eyes. hapi-docs is an open-source library brought to you by SurveyLegend®.

Features

  • Intuitive design — Inspired by Stripe’s API docs. The description of your API resides on the left part of the documentation, while all of the code examples reside on the right. Of course the layout is fully responsive and flawlessly adapts to tablets and phones.

  • Single page — The whole documentation resides on a single page, without sacrificing linkability. As you scroll through the documentation, your browser’s hash will update to the nearest section, which means linking to a particular point in the documentation remains natural and easy.

  • Scroll spy — Thanks to our custom and optimized scroll spy script, the far left navigation will smartly display your current position in the documentation, while scrolling through the documentation. It's swift and remains excellent even for larger documents.

  • Dark theme — Seamless switching between light and dark theme using a toggle. Supports prefers-color-scheme media query for automatic switching as well.

  • Markdown support — Use Markdown to describe your API. Markdown makes it easy to articulate your documentation.

  • Code examples in multiple languages — Configurable support for multiple languages. Easily choose which language to currently display in your documentation by switching between tabs.

  • Syntax highlighting — Supports over 100 languages out of the box.

  • RTL Support — Full Right-to-Left support for languages such as Arabic, Persian (Farsi), Hebrew, etc.

  • Anchor tags — With one click, users can easily link to a parameter, thanks to auto generated anchor tags.

Installation

This package can be used in hapi v19 or higher.

You can install the package via yarn:

$ yarn add @surveylegend/hapi-docs

Usage

Note Inert is a required dependency for hapi-docs to work properly.

import Hapi from '@hapi/hapi'
import Inert from '@hapi/inert'
import Joi from 'joi'
import HapiDocs from '@surveylegend/hapi-docs'
import { version } from './package'

const options = {
    info: {
        title: 'Test API Reference',
        version
    }
}

const startServer = async () => {
    const server = Hapi.server({
        host: 'localhost',
        port: 3000
    })

    await server.register([
        {
            plugin: Inert
        },
        {
            plugin: HapiDocs,
            options
        }
    ])

    await server.start()

    console.log(`Server listening on ${server.info.uri}`)
}

startServer().catch(console.error)

Demo

You can see a live demo version of hapi-docs. Check it out at hapi-docs

Documentation

Plugin Options

  • endpoint: (string) The path of the documentation - default: /docs
  • basePath: (string) The base path before the API, i.e. /v2 - default: /
  • templatePath: (string) The absolute path to the template folder, i.e. /template
  • host: (string) The hostname or IP serving the API, i.e. localhost:3000
  • scheme: (string) The transfer protocol of the API, i.e. http, https
  • pathPrefixSize: (number) The segment of the URL path that is used to group endpoints - default: 1
  • sortTags: (string) The sort method for groups, i.e. name, ordered - default: name
  • sortEndpoints: (string) The sort method for endpoints, i.e. path, method, ordered - default: path
  • info
    • title: (string) The title of the documentation - default: API Reference
    • version: (string) The version number of the API - default: 0.0.1
    • descriptions: (array) The description of the API.
  • tags: (array) Contains tag objects
    • name: (string) The name of the group.
    • descriptions: (array) The description of the group.
    • order: (int) The order which groups are sorted by.
    • deprecated: (boolean) Whether a group is deprecated - default: false
    • internal: (boolean) Whether a group is internal - default: false
    • uppercase: (boolean) Whether a group name is uppercase - default: false
  • errors:
    • descriptions: (array) The description of the errors.
    • codes: (array) Contains error code objects
      • status: (string) The status of the error code, i.e. 418 - I'm A Teapot
      • description: (string) The description of the error code.
  • auth: (boolean, string or object) The security strategy used for plugin resources - default: false

Route Options

  • order: (int) The order which endpoints are sorted by.
  • deprecated: (boolean) Whether an endpoint is deprecated - default: false
  • internal: (boolean) Whether an endpoint is internal - default: false

Tagging API Routes

If you want a route to appear in the documentation, you have to set tags: [api] for this specific route.

Here is an example snippet of a route option:

{
  method: 'GET',
  path: '/route',
  options: {
    handler: [...],
    [...]
    tags: ['api']
  }
}

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

Credits

Developed and designed by:

hapi-docs is inspired by hapi-swagger, lout, and Stripe’s API docs; and fully sponsored by SurveyLegend®.

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].