Skip to content

webwallet/api-nodejs

Repository files navigation

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

Name Description
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.
.dockerignore Folder and files ignored by docker usage.
.env.example Your API keys, tokens, passwords and database URI.
.eslintrc Rules for eslint linter.
.gitignore Folder and files ignored by git.
.travis.yml Configuration files for continue integration.
index.js The main application file.
docker-compose.yml Docker compose configuration file.
Dockerfile Docker configuration file.
package.json NPM dependencies.
package-lock.json Contains 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

Package Description
@webwallet/cryptools This library is used for all the cryptographic functions (key generations, signing, verifying,etc).
@webwallet/graphstore Library for querying and creating the representation of ious in the graph db neo4j.
@webwallet/hashtable Library for storing ious and transactions in google datastore
@webwallet/schemas Schemas defined using joi for validating the bodies of the http requests
bignumber.js Library for handling large numbers.
bs58check Library for checking .
dotenv Loads environment variables from .env file.
joi Library for validating joi.
json-stable-stringify Library for generating uniform json stringfied objects.
microapi Library for routing http requests.
module-alias Module for aliasing libs.
require-directory Require automating.

About

WebWallet API reference implementation in Node.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published