Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tealina/doc-ui

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tealina/doc-ui

For visualize and interact API's resources.

  • 1.0.4
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Automatic generate modern UI for visualize and interact API's resources.

The document resouces should be json file in @tealina/doc-types format.

Install

pnpm add @tealina/doc-ui

yarn add @tealina/doc-ui

npm i @tealina/doc-ui

Usage

  1. Build the route whith recourses
// buildDocRoute.ts
import express, { Router } from 'express'
import path from 'node:path'
import {
  TealinaVdocWebConfig,
  getAssetsPath,
  assembleHTML,
  VDOC_BASENAME,
} from '@tealina/doc-ui'

const vDocCofig: TealinaVdocWebConfig = {
  sources: [
    {
      baseURL: '/api/v1',
      jsonURL: `${VDOC_BASENAME}/v1.json`,
      name: 'v1',
    },
  ],
  errorMessageKey: 'message',
  features: {
    playground: {
      //...
    },
  },
}

const docRouter = Router({ caseSensitive: true })
  .get('/index.html', (req, res, next) => {
    assembleHTML(vDocCofig).then(html => res.send(html))
  })
  .get('/v1.json', (req, res, next) => {
    res.sendFile(path.resolve('docs/api-v1.json'))
  })
  .use(express.static(getAssetsPath()))

export { docRouter, VDOC_BASENAME }
  1. Regitst Route
// server.ts
import { VDOC_BASENAME, docRouter } from './buildDocRoute.ts'
express().use(VDOC_BASENAME, docRouter).listen(5000)
  1. Open the link after server started.
http://localhost:5000/api-doc/index.html

FAQs

Package last updated on 06 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc