Skip to content

LesFabricants/express-proxyfile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-proxyfile

a simple library to replace any current express application that uses the file system to serve files to switch to a cloud service

Installation

npm i @lesfabricants/express-proxyfile

In your application you use it as a middleware:

import {proxyFile} from "@lesfabricants/express-proxyfile";

//...

app = express();
app.use(proxyFile(myCloudHandler));


//...

app.get('/:somefiles', (req, res) => {
    res.sendFile('path to my file');
});

BuildIn Handler

S3 Object storage

import {s3Proxy} from "@lesfabricants/express-proxyfile";

//...

app = express();
app.use(s3Proxy({
    // Your S3 config
    endpoint: process.env.STORAGE_ENDPOINT,
    credentials: {
        accessKeyId: process.env.STORAGE_API_KEY,
        secretAccessKey: process.env.STORAGE_API_SECRET
    },
    region: process.env.STORAGE_REGION
}, "myBucketName"));


//...

app.get('/:somefiles', (req, res) => {
    res.sendFile('path to my file');
});

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published