node-beget
Version:
Client library for accessing Beget API
57 lines (40 loc) • 2.11 kB
Markdown
## node-beget
<!-- [](https://nodei.co/npm/node-beget/) -->
[](http://badge.fury.io/js/node-beget)
[](https://circleci.com/gh/olehcambel/node-beget)
[](https://coveralls.io/github/olehcambel/node-beget?branch=master)
[](https://snyk.io/test/github/olehcambel/node-beget?targetFile=package.json)
> [Beget](https://beget.com/en) wrapper for NodeJS. BegetAPI will allow to use most features of the administration panel directly from your own scripts, content management systems (CMS) and other software products.
### What can I do using Beget.API?
- Receive information about the web hosting account;
- Administer security backups;
- Administer the task planner;
- Adjust DNS;
- Administer databases;
- Create and delete websites on account;
- Manage domains settings;
- Manage mailboxes.
## Documentation
[See](https://olehcambel.github.io/node-beget/globals.html) documentation on endpoints in details
## example usage
```js
const { Beget } = require('node-beget');
// import { Beget } from 'node-beget';
const begetConfig = { login: 'login', password: 'password' };
const beget = new Beget(begetConfig);
// ...
// get account info
const accountInfo = await beget.user.getAccountInfo();
// toggle ssh
await beget.user.toggleSsh({ status: 1 });
await beget.mysql.dropAccess({ suffix: 'suffix', access: 'localhost' });
```
```js
const { UserEndpoint, BegetRequest } = require('node-beget');
// import { UserEndpoint, BegetRequest } from 'node-beget';
const begetConfig = { login: 'login', password: 'password' };
const begetClient = new BegetRequest(begetConfig);
const user = new UserEndpoint(begetClient);
// ...
await user.getAccountInfo();
```