ipx-s3-middleware
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

ipx-s3-middleware

A simple middleware which translates given image path to http sourced S3 url for IPX.

It basically enables you to source S3 urls (or any other public remote urls) by the path /s_200x200/path/to/image.jpg instead of /s_200x200/https://my-bucket.s3.us-west-2.amazonaws.com/path/to/image.jpg.

Usage

$ npm i ipx-s3-middleware
# or with yarn
$ yarn add ipx-s3-middleware

Example

server.js

const express = require('express');
const { createIPX } = require('ipx');
const { createIPXS3Middleware } = require('ipx-s3-middleware');

const s3BaseUrl = 'https://my-bucket.s3.us-west-2.amazonaws.com';

const ipx = createIPX({ domains: [s3BaseUrl] });

const app = express();
app.use('/images', createIPXS3Middleware(ipx, s3BaseUrl));

app.listen(3001, () => {
  console.log(`🚀 Image processing service is ready at http://localhost:3000`)
});

URL
GET http://localhost/images/{modifiers}/{objectPath}

Example: GET http://localhost:3001/images/s_200x200/path/to/image

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i ipx-s3-middleware

    Weekly Downloads

    0

    Version

    0.3.0

    License

    MIT

    Unpacked Size

    3.85 kB

    Total Files

    5

    Last publish

    Collaborators

    • dbtek