Skip to content

Commit ff8d66a

Browse files
committed
fmt
1 parent 30ef76b commit ff8d66a

File tree

1 file changed

+42
-44
lines changed

1 file changed

+42
-44
lines changed

README.md

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ This config file can contain an array of objects for all providers and all will
7979

8080
### Example
8181

82-
```
82+
```js
8383
const nodeCloudAwsPlugin = require("@nodecloud/aws-plugin");
8484
const nodeCloudGcpPlugin = require("@nodecloud/gcp-plugin");
8585
const nodeCloudAzurePlugin = require("@nodecloud/azure-plugin");
@@ -89,21 +89,21 @@ const providers = [
8989
name: "aws",
9090
tag: "aws",
9191
plugin: nodeCloudAwsPlugin,
92-
configPath: "C:\\Users\\Rajitha\\opensource\\aws_cred.json"
92+
configPath: "C:\\Users\\Rajitha\\opensource\\aws_cred.json",
9393
},
9494
{
9595
name: "google",
9696
tag: "google",
9797
plugin: nodeCloudGcpPlugin,
9898
configPath: {
9999
projectId: "astral-hold-276807",
100-
keyFilename: "C:\\Users\\Rajitha\\opensource\\gcp_cred.json"
101-
}
100+
keyFilename: "C:\\Users\\Rajitha\\opensource\\gcp_cred.json",
101+
},
102102
},
103103
{
104104
name: "azure",
105105
tag: "azure",
106-
plugin: nodeCloudAzurePlugin
106+
plugin: nodeCloudAzurePlugin,
107107
},
108108
];
109109
module.exports = providers;
@@ -115,68 +115,66 @@ Congratulations! You just configured NodeCloud in your project. Let's start with
115115

116116
The below code is an example of usage in AWS.
117117

118-
```
118+
```js
119119
const nc = require("@nodecloud/common"); // NodeCloud common module
120120
const optionsProvider = {
121-
overrideProviders: false
121+
overrideProviders: false,
122122
};
123123
const ncProviders = nc.getProviders(optionsProvider);
124124
const options = {
125-
apiVersion: "2017-11-01"
125+
apiVersion: "2017-11-01",
126126
};
127127

128128
const computeModule = ncProviders.aws.compute(options);
129129

130130
function launchInstance() {
131-
const instanceParams = {
132-
ImageId: "ami-07ebfd5b3428b6f4d", // Image of Ubuntu Server 18.04 LTS
133-
InstanceType: "t2.micro",
134-
KeyName: "nodeCloud", // key name of Key pair
135-
MinCount: 1,
136-
MaxCount: 1
137-
};
138-
139-
// create AWS EC2 instance
140-
computeModule
141-
.create(instanceParams)
142-
.then(res => {
143-
console.log( `All done ! ${res}` );
144-
})
145-
.catch(err => {
146-
console.log( `Oops something happened ${err}` );
147-
});
131+
const instanceParams = {
132+
ImageId: "ami-07ebfd5b3428b6f4d", // Image of Ubuntu Server 18.04 LTS
133+
InstanceType: "t2.micro",
134+
KeyName: "nodeCloud", // key name of Key pair
135+
MinCount: 1,
136+
MaxCount: 1,
137+
};
138+
139+
// create AWS EC2 instance
140+
computeModule
141+
.create(instanceParams)
142+
.then((res) => {
143+
console.log(`All done ! ${res}`);
144+
})
145+
.catch((err) => {
146+
console.log(`Oops something happened ${err}`);
147+
});
148148
}
149149

150150
function stopInstance() {
151-
const params = {
152-
InstanceIds: ["i-0928af5c626f85da9"],
153-
DryRun: false
154-
};
155-
156-
// stop AWS EC2 instance
157-
computeModule
158-
.stop(params)
159-
.then(res => {
160-
console.log(res);
161-
})
162-
.catch(err => {
163-
console.log(err);
164-
});
151+
const params = {
152+
InstanceIds: ["i-0928af5c626f85da9"],
153+
DryRun: false,
154+
};
155+
156+
// stop AWS EC2 instance
157+
computeModule
158+
.stop(params)
159+
.then((res) => {
160+
console.log(res);
161+
})
162+
.catch((err) => {
163+
console.log(err);
164+
});
165165
}
166-
167166
```
168167

169168
## Overriding Providers
170169

171170
NodeCloud officially supports AWS, GCP, Azure, DigitalOcean and AliCloud. If you want to use a community-driven plugin override the providers' list as follows.
172171

173-
```
172+
```js
174173
const nodeCloud = require("nodecloud");
175174
const options = {
176-
overrideProviders: true
175+
overrideProviders: true,
177176
};
178177
const ncProviders = nodeCloud.getProviders(options);
179-
180178
```
181179

182180
## 📟 Service Types
@@ -317,4 +315,4 @@ This is where the magic happens✨. We don't code any JavaScript classes in Node
317315

318316
## 📜 License
319317

320-
MIT
318+
MIT @ leopardslab

0 commit comments

Comments
 (0)