Skip to content

Commit 772f91b

Browse files
committed
platform/getting_started
1 parent a1aeb4d commit 772f91b

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

content/academy/apify_platform/getting_started/creating_actors.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The area where you can see some code and files is called the **multifile editor*
3535
Go ahead and delete the three lines of code in the **main.js** file that look like this:
3636

3737
```JavaScript
38-
const input = await Apify.getInput();
38+
const input = await Actor.getInput();
3939
console.log('Input:');
4040
console.dir(input);
4141
```
@@ -51,11 +51,13 @@ console.log('Hello World!')
5151
The final code should look like this:
5252

5353
```JavaScript
54-
const Apify = require('apify');
54+
import { Actor } from 'apify';
5555

56-
Apify.main(async () => {
57-
console.log('Hello World!')
58-
});
56+
await Actor.init();
57+
58+
console.log('Hello World!')
59+
60+
await Actor.exit();
5961
```
6062

6163
To save your changes, click on the blue **Save** button.

content/academy/apify_platform/getting_started/inputs_outputs.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,20 @@ Let's first create another new actor using the same template as before. Feel fre
1919
Replace all of the code in **main.js** with this code snippet:
2020

2121
```JavaScript
22-
const Apify = require('apify');
23-
24-
Apify.main(async () => {
25-
// Grab our numbers which were inputted
26-
const { num1, num2 } = await Apify.getInput();
27-
28-
// Calculate the solution
29-
const solution = num1 + num2;
30-
31-
// Push the solution to the dataset
32-
await Apify.pushData({ solution })
33-
});
22+
import { Actor } from 'apify';
23+
24+
await Actor.init();
25+
26+
// Grab our numbers which were inputted
27+
const { num1, num2 } = await Actor.getInput();
28+
29+
// Calculate the solution
30+
const solution = num1 + num2;
31+
32+
// Push the solution to the dataset
33+
await Actor.pushData({ solution })
34+
35+
await Actor.exit();
3436
```
3537

3638
Then, replace everything in **INPUT_SCHEMA.json** with this:

0 commit comments

Comments
 (0)