NextJS
You can use NextJS API paths to define and expose your Cross-Chain Sherry Link and publish it on Vercel (or other provider).
Next.js provides built-in API routes, making it an excellent choice for projects that combine frontend and backend functionality.
Create a new Next.js project
Install the SDK
Open the project in your preferred editor. For example VSCode
Navigate to the pages/api/example folder and create a file named route.ts
For educational purposes, we use "Access-Control-Allow-Origin": "*", but in a production environment, you must restrict allowed origins to the official Sherry domains: staging.sherry.social and app.sherry.social.This enhances the security of your infrastructure and prevents potential unnecessary costs caused by unauthorized requests.
Save the file and start the development server:
- http://localhost:3000/api/example
- One deployed, the metadata endpoint will be accesible at a URL like:
- https://your-domain.vercel.app/api/example
In the example we have implemented a try-catch to catch any run-time errors. You can create an instance of all the errors that could occur during the execution of createMetadata.