Local access to api documentation
Embed in a npm module with built in webserver, and then npx theDocsModule
that would start up a local webserver.
The example code I tried:
#!/usr/bin/env node
const handler = require('serve-handler');
const http = require('http');
const open = require('open');
const path = require('path');
const server = http.createServer((request, response) => {
// You pass two more arguments for config and middleware
// More details here: https://github.com/zeit/serve-handler#options
return handler(request, response,{
"public": path.join(__dirname,"docs/master")
});
})
server.listen(3000, async () => {
console.log('Running at http://localhost:3000');
// Opens the URL in the default browser
await open('http://localhost:3000');
});
with these dependencies at the time of writing
"dependencies": {
"open": "^6.4.0",
"serve-handler": "^6.1.2"
}