2.0.0 • Published 1 year ago

@mangar2/keyvaluestore v2.0.0

Weekly downloads
-
License
LGPL-3.0-or-later
Repository
github
Last release
1 year ago

Abstract

Contents

Meta

Global functions

close

async close ()

Closes the server , stops listening

onGet

async onGet (path, res)

Handles a get request

onGet Parameters

NameTypeDescription
pathstringget request path
resobjectget request result object

onOptions

onOptions (payload, path, res)

Handles a post request

onOptions Parameters

NameTypeDescription
payloadstringobject payload
pathstringpath of the request
resobjectresult object

onPost

async onPost (payload, headers, path, res)

Handles a post request

onPost Parameters

NameTypeDescription
payloadstringobject payload
headersobjectrequest headers
pathstringpath of the request
resobjectresult object

readFile

async readFile (path) => {any}

Reads a file from the key value store

readFile Parameters

NameTypeDescription
pathstringpath used to identify the file

readFile returns

TypeDescription
anyobject read

run

run ()

Starts the server

writeFile

async writeFile (path, object)

Writes a file to the key value store

writeFile Parameters

NameTypeDescription
pathstringpath used to identify the file
objectanyobject to store ( it will be stringified )