1.6.1 • Published 4 years ago

@webwallet/api v1.6.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

WebWallet API reference implementation in Node.js

Dependency Status

This is an implementation in node.js along with neo4j and datastore of the webwallet api reference.

Table of Contents

Prerequisites

Getting Started

The easiest way to get started is to clone the repository:

# Get the latest snapshot
git clone https://github.com/webwallet/api.git webwallet

# Change directory
cd webwallet

# Install NPM dependencies
npm install

# Then simply start your app
node index.js

Note: It is recommended to install Nodemon. It watches for any changes in your node.js app and automatically restarts the server. Once installed, instead of node app.js use nodemon app.js. It will save you a lot of time in the long run, because you won't need to manually restart the server each time you make a small change in code. To install, run sudo npm install -g nodemon.

Project Structure

The project is structure using the microapi library, this library add underneath the http paths to expose in a plug and play web service. Unlike express.js, you don't to explicitly add every path and file in an initializer file. For instance the path for a POST to http://localhost:3000/transaction

NameDescription
api/definitions/Definitions used in the app.
api/middleware/Middleware for microapi.
api/routes/Http routes for the api.
api/schemas/Joi schemas to validate the incoming bodies for every route.
.dockerignoreFolder and files ignored by docker usage.
.env.exampleYour API keys, tokens, passwords and database URI.
.eslintrcRules for eslint linter.
.gitignoreFolder and files ignored by git.
.travis.ymlConfiguration files for continue integration.
index.jsThe main application file.
docker-compose.ymlDocker compose configuration file.
DockerfileDocker configuration file.
package.jsonNPM dependencies.
package-lock.jsonContains exact versions of NPM dependencies in package.json.

Note: There is no preference how you name or structure your views. You could place all your templates in a top-level views directory without having a nested folder structure, if that makes things easier for you. Just don't forget to update extends ../layout and corresponding res.render() paths in controllers.

List of Packages

PackageDescription
@webwallet/cryptoolsThis library is used for all the cryptographic functions (key generations, signing, verifying,etc).
@webwallet/graphstoreLibrary for querying and creating the representation of ious in the graph db neo4j.
@webwallet/hashtableLibrary for storing ious and transactions in google datastore
@webwallet/schemasSchemas defined using joi for validating the bodies of the http requests
bignumber.jsLibrary for handling large numbers.
bs58checkLibrary for checking .
dotenvLoads environment variables from .env file.
joiLibrary for validating joi.
json-stable-stringifyLibrary for generating uniform json stringfied objects.
microapiLibrary for routing http requests.
module-aliasModule for aliasing libs.
require-directoryRequire automating.