2018-01-17 22:29:00 +01:00
|
|
|
---
|
|
|
|
id: node-api
|
|
|
|
title: "Node API"
|
|
|
|
---
|
|
|
|
|
2018-01-20 23:00:45 +01:00
|
|
|
Verdaccio can be invoqued programmatically. The node API was introduced after version `verdaccio@3.0.0-alpha.10`.
|
2018-01-17 22:29:00 +01:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
#### Programmatically
|
|
|
|
|
|
|
|
```js
|
|
|
|
import startServer from 'verdaccio';
|
|
|
|
|
|
|
|
startServer(configJsonFormat, 6000, store, '1.0.0', 'verdaccio',
|
|
|
|
(webServer, addrs, pkgName, pkgVersion) => {
|
|
|
|
webServer.listen(addr.port || addr.path, addr.host, () => {
|
|
|
|
console.log('verdaccio running');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
```
|
2018-01-21 10:10:10 +01:00
|
|
|
|
2018-01-21 10:12:17 +01:00
|
|
|
## Other implementations
|
2018-01-21 10:10:10 +01:00
|
|
|
|
|
|
|
* [verdaccio-server](https://github.com/boringame/verdaccio-server) local npm registry proxy server
|
|
|
|
|
|
|
|
```js
|
|
|
|
// 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();
|
|
|
|
```
|