@shareandcharge/sharecharge-api
v0.12.3
Published
HTTP webserver for the Share&Charge e-Mobility Network
Downloads
5
Readme
sharecharge-api
HTTP webserver for the Share&Charge e-Mobility Network
Install and setup
Shell
Package installation:
npm install -g @motionwerk/sharecharge-api
Run:
sc-api
The server will start, showing you the host and port it is listening on, as well as your authorization token.
To test everything is working, run:
curl -H 'Authorization: Token <YOUR_AUTH_TOKEN>' http://localhost:3000/api/token/info
You should see the following:
{
"name": "Share&Charge Token",
"symbol": "SCT",
"address": "0x407d3449819A6e47ce43687d58B3C00dCed77bc8",
"owner": "0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e"
}
The host and port are also configurable via environment variables:
PORT=3001 HOST=0.0.0.0 sc-api
Module Import
The server is also available as a Node module:
import scApi from '@motionwerk/sharecharge-api';
const host = '0.0.0.0';
const port = 3001
scApi(host, port);
Documentation
After running the server you can visit http://localhost:3000/api/docs
(by default) to view the API documentation.
API documentation is generated using apiDoc.
Development
git clone [email protected]:motionwerkGmbH/sharecharge-api.git
cd sharecharge-api
npm install
npm start
Building new documentation
npm run doc && npm start