Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
littlefork-http
Advanced tools
Wrap littlefork around a HTTP API.
git clone git@gitlab.com:littlefork/littlefork-api.git
cd littlefork-api
npm install
The littlefork API is configured using environment variables. It's possible to
configure options in a local file, .env
. This file will not be added to
the git repository, an entry in the .gitignore
prevents that.
cp .env.example
cat .env // Edit as necessary
LF_API_PORT
:: The port to listen on. Defaults to 6667.LF_API_DATA_DIR
:: The path to the storage directory. Defaults to ./data
.LF_API_KEY
:: The api key that should be sent in a header to auth the requestTo simply run the API, start the server: npm run server
. This starts a
server on the port defined in the environment as LF_API_PORT
.
There are local targets to run the linting, documentation building and unit
testing. Simply start a development setup: npm run dev
.
The package exports the server as a binary. Add littlefork-http
as a
dependency and run the server:
$(npm bin)/littlefork-http
To build the latest version of this readme run: npm run docs:api
. This
rebuilds this readme file.
The HTTP routes are documented as well. To build them run: npm run docs:rest
.
This will build HTML documentation for the HTTP routes. They can be found in
docs/rest
.
firefox docs/rest/index.html
To build all docs, run: npm run docs
.
All functions are curried:
read('path/to/dir', 'project'); // =
read('path/to/dir')('project');
curl test:
curl -v -H "apikey: haha" http://localhost:8666/projects
Read a file and return it as parsed JSON.
read :: String -> String -> Future Json
Parameters
Returns Promise<Object> The parsed JSON that was read from the file.
Initialize a node.
init :: String -> Future ()
Parameters
p
String The path of the node.Returns Promise<Null> Returns Unit
, pure side effect.
Write data into a node. Initialize the node recursively if it doesn't exist.
write :: String -> String -> {} -> Future ()
Parameters
Returns Promise<Null> Returns Unit
, pure side effect.
Read a node for all data and sub nodes.
readNode :: String -> Future [[Object], [String]]
const [fs, ds] = readNode('data/projects');
// fs => [{...}, {...}]
// ds = ['other', 'nodes']
Parameters
p
String The path of the node.Returns Promise<Array<Array<Object>, Array<String>>> Returns an array tuple with the first element being a list of data units, and the second element a list of sub nodes.
List the data in a node.
list :: String -> Future [Object]
Parameters
p
String The path of the node.FAQs
A HTTP interface for littlefork.
We found that littlefork-http demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.