Here's an example of how to create an Express server in TypeScript that uses the Sharp module to resize images. The request URL should include the source image's path, width, height, and quality options as query parameters:
index.ts642 chars24 lines
Here's an example request:
index.ts67 chars2 lines
This will resize the image located at my-image.jpg
to have a width and height of 200 pixels, and a quality of 80. The server will return the resized image as a JPEG.
gistlibby LogSnag