1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/website/docs/node-api.md
Sergio Moreno a6b0d63afb
feat: migrate Verdaccio.org to Docusaurus v2 and new design (#2343)
Co-authored-by: Juan Picado <juanpicado19@gmail.com>
2021-07-27 21:52:49 +02:00

1.0 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

 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');
		});
  });

Other implementations

// 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();