mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-13 03:35:52 +01:00
76d78b0328
* Working node JS Code Maybe add where do the `addrs` comes from ? Added host and port display cause otherwise user doesn't know which default address and port are. * Removing comments because I'm unsure about these / they are incorrect Please complete it if you know how to make it work with a configFilePath as third parameter * chore: fix website config Co-authored-by: Juan Picado <juanpicado19@gmail.com>
1.7 KiB
1.7 KiB
id | title |
---|---|
node-api | Node API |
Verdaccio can be invoked programmatically. The Node API was introduced after version verdaccio@3.0.0
.
Usage
Programmatically
const startServer = require("verdaccio").default;
let config = {
storage: "./storage",
auth: {
htpasswd: {
file: "./htpasswd"
}
},
uplinks: {
npmjs: {
url: "https://registry.npmjs.org/",
}
},
self_path: "./",
packages: {
"@*/*": {
access: "$all",
publish: "$authenticated",
proxy: "npmjs",
},
"**": {
proxy: "npmjs"
}
},
logs: [
{
type: "stdout",
format: "pretty",
level: "http",
}
],
};
startServer(
config,
6000,
undefined,
"1.0.0",
"verdaccio",
(webServer, addrs) => {
webServer.listen(
addrs.port || addrs.path,
addrs.host,
() => {
console.log(`verdaccio running on : ${addrs.host}:${addrs.port}`);
}
);
}
);
Other implementations
- verdaccio-server local npm registry proxy server
// js
import * as verdaccioServer from "verdaccio-server";
verdaccioServer.start();
verdaccioServer.stop();
verdaccioServer.list();
verdaccioServer.stopAll();
verdaccioServer.show();
verdaccioServer.cli();
// windows .net2
verdaccioServer.serviceInstall();
verdaccioServer.serviceUninstall();
verdaccioServer.serviceStart();
verdaccioServer.serviceStop();
verdaccioServer.serviceRestart();