- Navigate to the project directory
> yarn install
- Create a
.env
file in the project root directory with the following variables
LOTUS_URL=ws://<ip address of Filecoin node>/rpc/v0
LOTUS_AUTH_TOKEN=<Lotus RPC API authorization token with admin permissions>
COPY_NUMBER=3
ENCRYPTION_KEY=<encryption key>
PRICE=5000000000
COPY_NUMBER=3
PORT=XXXX
LOGS_ERROR_BASE_PATH='./logs/'
LOGS_ERROR_FILE_NAME='error.log'
LOGS_COMBINED_BASE_PATH='./logs/'
LOGS_ERROR_COMBINED_FILE_NAME='combined.log'
READINESS_FAILURE_THRESHOLD='2'
READINESS_PERIOD='5'
SHUTDOWN_TIMEOUT_SECONDS='15'
One way to find Lotus IP, port number and auth token is lotus auth api-info --perm admin
command.
Note:
- Leave ENCRYPTION_KEY
empty if you want to opt out for encryption.
- Execute the following to run the API and expose the routes
> yarn start
---
*info: Starling api listening on port: XXXX* should be displayed
Navigate to the project directory
> yarn install
To ensure a friendly development environment, nodemon
is used to enable a hot reload feature on save
> yarn start:dev
All the following routes require this header
Accept:application/vnd.starling+json; version=1.0
The routes will be exposed at: http://localhost:3000
/ping
/api/store
/api/monitor
/api/list
/api/verify
/api/jobStatus/uuid
/api/get/uuid
- Check if service is up and ready, you should get a pong in the body
GET http://localhost:3000/ping
- Store a file or folder
This will require a JSON object to be sent with the request body - supplying it with the full file/folder path.
{
"dataPath":"/Users/xxxxxx/Desktop/xxxxx/xxxx/xx/test-file.jpg"
}
POST http://localhost:3000/api/store
- Get the list data
GET http://localhost:3000/api/list
- Get the verify data
GET http://localhost:3000/api/verify
- Get the Job Status data of a single job
GET http://localhost:3000/api/jobStatus/<uuid>
- Get a single file
GET http://localhost:3000/api/get/<uuid>