1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-17 07:45:52 +01:00
verdaccio/website/translated_docs/zh-CN/node-api.md
2018-08-09 08:05:57 +02:00

41 lines
1001 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: node-api
title: "Node API"
---
Verdaccio 可以以编程方式调用。node API在版本`verdaccio@3.0.0-alpha.10`后被引入。
## 使用
#### 编程
```js
mport 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');
});
});
```
## 其他执行
* [verdaccio-server](https://github.com/boringame/verdaccio-server) 本地 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();
```