This is the Upload API for HUB. It allows users to upload files to the server using the Bundlr service.
To setup the server, follow these steps:
- Install the dependencies by running
npm install - Set the environment variables
IRYS_GATEWAY,IRYS_URL,SOLANA_RPC_URL, andSOLANA_KEYPAIR. Note thatIRYS_GATEWAYshould be an Arweave compatible gateway for retrieving assets over HTTP. - Start the server by running
npm start
The available routes are:
- POST /uploads: Upload a file or JSON. This route accepts either a file as multipart/form-data or a JSON object and returns the URI and CID of the uploaded file.
The Swagger documentation for the API is available at /documentation.
If there is a validation error in the request, the server will respond with a 400 status code and the validation error.
The server uses the fastify-multipart plugin to handle file uploads. The server is configured to accept a maximum of 1 file field and 0 non-file fields.