File tree Expand file tree Collapse file tree 2 files changed +21
-17
lines changed
content/academy/apify_platform/getting_started Expand file tree Collapse file tree 2 files changed +21
-17
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ The area where you can see some code and files is called the **multifile editor*
35
35
Go ahead and delete the three lines of code in the ** main.js** file that look like this:
36
36
37
37
``` JavaScript
38
- const input = await Apify .getInput ();
38
+ const input = await Actor .getInput ();
39
39
console .log (' Input:' );
40
40
console .dir (input);
41
41
```
@@ -51,11 +51,13 @@ console.log('Hello World!')
51
51
The final code should look like this:
52
52
53
53
``` JavaScript
54
- const Apify = require ( ' apify' ) ;
54
+ import { Actor } from ' apify' ;
55
55
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 ();
59
61
```
60
62
61
63
To save your changes, click on the blue ** Save** button.
Original file line number Diff line number Diff line change @@ -19,18 +19,20 @@ Let's first create another new actor using the same template as before. Feel fre
19
19
Replace all of the code in ** main.js** with this code snippet:
20
20
21
21
``` 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 ();
34
36
```
35
37
36
38
Then, replace everything in ** INPUT_SCHEMA.json** with this:
You can’t perform that action at this time.
0 commit comments