https://github.com/nodesource/ncm-proxy
Local Proxy for NCM 2.0
https://github.com/nodesource/ncm-proxy
Last synced: 8 months ago
JSON representation
Local Proxy for NCM 2.0
- Host: GitHub
- URL: https://github.com/nodesource/ncm-proxy
- Owner: nodesource
- License: mit
- Created: 2019-01-15T16:06:13.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-01-07T07:09:06.000Z (about 5 years ago)
- Last Synced: 2025-04-14T18:53:20.781Z (9 months ago)
- Language: JavaScript
- Size: 70.3 KB
- Stars: 3
- Watchers: 20
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ncm-proxy
Local Proxy for [NCM 2.0](https://docs.nodesource.com/ncm_v2/docs).
## About
This is a simple proxy server that is run locally on the computer doing the `npm` installations. When an install happens it will use the NCM API to look up score data and then either just log what was done or rewrite the proxied results to prevent installs of non-certified information.
## Usage
Start an ncm proxy server on port `14313` (`14`=N, `3`=C, `13`=M):
```bash
$ NCM_TOKEN=xxx npx @nodesource/ncm-proxy
```
To obtain an ncm token please see [the docs](https://docs.nodesource.com/ncm_v2/docs#ci-createatoken).
Then configure as your npm registry:
```bash
$ npm install express --registry=http://localhost:14313
```
## Custom port
Set the `PORT` environment variable to launch on a different port:
```bash
$ NCM_TOKEN=xxx PORT=8080 npx @nodesource/ncm-proxy
```
## Custom registry
You can also use a different registry than the default `https://registry.npmjs.org/`:
```bash
$ NCM_TOKEN=xxx npx @nodesource/ncm-proxy https://registry.npmjs.org
```
## Routes
All except listed routes are simply proxied through:
### `GET /:package`
### `GET /@scope%2f:package`
Rewrite tarball urls to point at the proxy.
### `GET /:package/-/:package-:version.tgz`
### `GET /@:scope?/:package/-/:package-:version.tgz`
Return `404` if the module has a score lower than 85 or is on the whitelist,
otherwise proxy through.
# License & copyright
Copyright © NodeSource.
Licensed under the MIT open source license, see the LICENSE file for details.