@mangar2/keyvaluestore
v2.0.0
Published
implements a simple key/value store service
Downloads
4
Readme
Abstract
Contents
Meta
Global functions
close
async close ()
Closes the server , stops listening
onGet
async onGet (path, res)
Handles a get request
onGet Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| path
| string
| get request path | |
| res
| object
| get request result object | |
onOptions
onOptions (payload, path, res)
Handles a post request
onOptions Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| payload
| string
| object payload | |
| path
| string
| path of the request | |
| res
| object
| result object | |
onPost
async onPost (payload, headers, path, res)
Handles a post request
onPost Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| payload
| string
| object payload | |
| headers
| object
| request headers | |
| path
| string
| path of the request | |
| res
| object
| result object | |
readFile
async readFile (path) => {any}
Reads a file from the key value store
readFile Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| path
| string
| path used to identify the file | |
readFile returns
| Type | Description |
| ---- | ----------- |
| any
| object read |
run
run ()
Starts the server
writeFile
async writeFile (path, object)
Writes a file to the key value store
writeFile Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| path
| string
| path used to identify the file | |
| object
| any
| object to store ( it will be stringified ) | |