Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nithinsgowda/pass-cors

A simple proxy to load CORS blocked image - NPM module
https://github.com/nithinsgowda/pass-cors

cors cors-proxy expressjs file-proxy nodejs npm proxy

Last synced: 2 months ago
JSON representation

A simple proxy to load CORS blocked image - NPM module

Awesome Lists containing this project

README

        

# **pass-cors**
**A simple proxy to load CORS blocked files**

Must be used in an express server environment

```console
$ npm i pass-cors
```

- Can be Used with any file type
- Just two lines of integration
- Eliminate third party proxy server dependency
- No need of a separate server to be hosted just for proxy
- This will function as a part of your current server and opens up a custom path set by the user



## Server Side
```javascript

//Boilerplate
const express = require('express')
const app = express()

//Main
const proxy = require('pass-cors')
app.use('/proxy', proxy); //You can customise the route name

//Boilerplate
app.listen(process.env.PORT||8080)

```



## Client Side

Before
```html

```

After
```html

```



Thats how easy it is to load a CORS blocked elements on your frontend