Rodrigo
Rodrigo

Reputation: 391

NextJS rewrite url to ends in .jpg

I have an API endpoint /api/thumbnail which returns a JPEG image.

What I want is make this endpoint accepts .jpg, like this /api/thumbnail.jpg.

Is it possible using pure NextJS or I need to use vercel.json?

Upvotes: 1

Views: 167

Answers (1)

brc-dd
brc-dd

Reputation: 13024

Simply change your file name from

./pages/api/thumbnail.(js|ts)x?

to

./pages/api/thumbnail.jpg.(js|ts)x?

Upvotes: 1

Related Questions