Hono is a lightweight web framework for Deno and Node.js. It is designed to be fast, simple, and easy to use. In this framework guide we’ll show you how to create a server that sends Presigned URLs to a client app for a secure client side upload flow. We would highly recommend pairing this guide with the React framework guide!Documentation Index
Fetch the complete documentation index at: https://pinata-car-creator.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Installation
Create an API Key and get Gateway URL
To create an API key, visit the Keys Page and click the “New Key” button in the top right. Once you do that you can select if you want your key to be admin or if you want to scope the privileges of the keys to certain endpoints or limit the number of uses. Make those selections, then give the key a name at the bottom, and click create key.The API keys are only shown once, so be sure to copy them somewhere safe!
Start up Hono Project
Run the command below to make a new Hono project:Cloudflare Workers which is what we’ll follow through with in this guide. After selecting that cd into the project and install the Pinata SDK.
.dev.vars file in the root of the project and put in the following variables:
JWT from the API key creation in the previous step as well as the Gateway Domain. The format of the Gateway domain should be mydomain.mypinata.cloud.
Implement the Server Code
Inside thesrc/index.ts file paste in the following code:
src/index.ts
/- A home route that just returnsHello Hono!/presigned_url- A route that will return a Presigned URL that is only valid for 60 seconds which our client can use to upload
Usage
Test it out by running the following command in your terminalhttp://localhost:8787. While this is running, in a separate terminal window run this curl to test the API endpoint:
Continue to React Guide
To see how you can use Presigned URLs with a client side framework check out the React guide