Installation
Quick start guide for installing and using Slingshot.
Configure Slingshot server
Create a Slingshot server handler, this will be used create presigned URLs for a specific upload profile, eg avatar
.
Create a file upload component
Add the FileUpload
component to your page.
This example is unstyled, you can style it yourself or use one of our UI library integrations.
Mount handlers
To handle the upload requests, you need to mount the handlers.
Create a new route in your framework that will handle the upload requests.
The route path should start with /api/slingshot/
and include the profile name, eg /api/slingshot/avatar
.
The Slingshot server runs on Hono
and supports any framework that supports
standard Request and Response objects.
Adapter
Lastly we need to configure an adapter to connect to your storage provider.
Open the slingshot profile (lib/slingshot/avatar.ts
) and add an adapter.
Done!
Now you're ready to upload files! Continue to the Basic usage section to learn more.