ryanto / next-s3-upload

Upload files from your Next.js app to S3
https://next-s3-upload.codingvalue.com/
548 stars 78 forks source link

Add custom endpoint with App router #171

Open thomasmorice opened 10 months ago

thomasmorice commented 10 months ago

Currently using the AppRouter configuration export { POST } from "next-s3-upload/route"; There is no way to add a custom endpoint

ryanto commented 10 months ago

does this work?

import { POST as route } from "next-s3-upload/route";

export const POST = route.configure({
  // ...
});
thomasmorice commented 10 months ago

I get an error: hostname: sts.fra1.amazonaws.com, Seems like the hostname is not being updated by the endpoint passed as a parameter within route.configure({...})

ryanto commented 10 months ago

Can you share your code?

tonyng3101 commented 1 month ago

This answer is very late but I still want to share to who need it and thank to your answer @ryanto


import { POST as route } from 'next-s3-upload/route';

const POST = route.configure({
   // your configuration
});

export { POST };