koa-vault
v1.0.0
Published
Archive Koa responses, for historical purposes.
Downloads
3
Maintainers
Readme
🗝 Koa Vault
Archive Koa responses, for historical purposes.
This project will save JSON responses to a local directory, which can be later used when the API is decommissioned. Read about why this project was created here.
Could be used with koa-proxy to scrape arbitrary API's.
Installation
yarn add koa-vault
Usage
// ecmascript module
import vault from 'koa-vault'
// commonjs
const vault = require('koa-vault')
app.use(
vault({
directory: './vault', // default
offline: false //default
})
)
Saved files
→ program → mulatu-astatke.json
→ program → nakhane.json
→ program → neneh-cherry.json
→ program → oneohtrix-point-never.json
JSON files will be saved to the vault
directory. Due to file naming conventions, forward slashes are replaced with forward arrows (→), and question marks with question blocks (░).
Only GET
requests with application/json
content-type header responses will be saved. If this does not suit your needs, please open a pull request.
Offline/archive
When turning the offline
option on, GET
requests will be served from the vault
directory. If the file does not exist, a 404
error will be thrown.