A client for the DevDocs JSON API
npm install devdocs-clientA JavaScript client for the devdocs.io JSON API.
``bash`
$ npm install devdocs-client
`js
const devdocs = require('devdocs-client');
devdocs.getAvailableDocs()
.then(docs => console.log(docs));
`
Lists available documentation.
GET https://devdocs.io/docs/docs.json
`js`
getAvailableDocs()
.then(docs => console.log(docs))
`js`
[
{
name: 'JavaScript',
slug: 'javascript',
type: 'mdn',
mtime: 1534718903,
db_size: 5793848
},
...
]
Gets metadata for a slug.
GET https://docs.devdocs.io/{slug}/meta.json
`js`
getMetadataForSlug()
.then(metadata => console.log(metadata))
`js`
{
name: 'JavaScript',
slug: 'javascript',
type: 'mdn',
mtime: 1534718903,
db_size: 5793848
}
Gets entries and types for a slug.
GET https://docs.devdocs.io/{slug}/index.json
`js`
getIndexForSlug()
.then(index => console.log(index))
`js`
{
entries: [
{
name: '!',
path: 'operators/logical_operators#Logical_NOT',
type: 'Operators'
},
...
],
types: [
{
name: 'Array',
count: 40,
slug: 'array'
},
...
]
}
Gets documentation for a slug.
GET https://docs.devdocs.io/{slug}/db.json
`js`
getDocsForSlug()
.then(docs => console.log(docs))
`js``
{
'statements/const': 'const
Constants are block-scoped, much like...',
...
}
See: CONTRIBUTING.md
See: LICENCE.md