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

docs-server

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docs-server

A server which is used to build a microserver for docs system

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Docs-server npm

A server which is used to build a microserver for docs system.

Feature

  • Automatic search markdown files and generate correct dynamic route according to root path.

  • Support for specifying additional static routes.

Notice

Only support second-level directory temporarily.

Your project structure should be like this:

├── doc [custom directory name]
|    ├── a.md
|    ├── b.md
|    ├── c.md
|    └── d.md
|
├── docs-server.config.js [define your custom config]
|
├── something.json [additional static route]
|
...
└── package.json

Usage

  1. You should specify your documents directory.
// docs-server.config.js
const send = require('koa-send')
const resolve = require('path').resolve

module.exports = {
  // documents directory (required)
  // based on root path
  docsPath: 'doc',

  // extra static file route (optional)
  routes: [
    {
      path: 'menu',
      callback: async (ctx, next) => {
        await send(ctx, './menu.json', {
          root: resolve(__dirname, './')
        })
      }
    },
    {
      path: 'something',
      callback: async (ctx, next) => {
        await send(ctx, './something.json', {
          root: resolve(__dirname, './')
        })
      }
    }
  ]
}
  1. Import module and run it
const DocsServer = require('docs-server')

// It should be running at http://localhost:8800 by default
const app = new DocsServer()
  1. ( Optional ) You can specify output path of catalog file ( menu.json ) and server port.
const app = new DocsServer({
  catalogOutput: path.resolve(__dirname, './')
  port: '3000'
})

Keywords

FAQs

Package last updated on 24 Jul 2018

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