Skip to content

Commit 2126b92

Browse files
committed
fix: running a web server
1 parent 0c0a98f commit 2126b92

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

content/academy/apify_platform/running_a_web_server.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Our server needs two paths:
4242
First, we'll import `express` and create an Express.js app. Then, we'll add some middleware that will allow us to receive form submissions.
4343

4444
```JavaScript
45-
import Apify from 'apify';
45+
import { Actor } from 'apify';
4646
import express from 'express';
4747

4848
const app = express()
@@ -115,7 +115,7 @@ app.post('/add-url', async (req, res) => {
115115
console.log(`Got new URL: ${url}`);
116116

117117
// Start chrome browser and open new page ...
118-
const browser = await Apify.launchPuppeteer();
118+
const browser = await Actor.launchPuppeteer();
119119
const page = await browser.newPage();
120120

121121
// ... go to our URL and grab a screenshot ...
@@ -127,7 +127,7 @@ app.post('/add-url', async (req, res) => {
127127
await browser.close();
128128

129129
// ... save screenshot to key-value store and add URL to processedUrls.
130-
await Apify.setValue(`${processedUrls.length}.jpg`, screenshot, { contentType: 'image/jpeg' });
130+
await Actor.setValue(`${processedUrls.length}.jpg`, screenshot, { contentType: 'image/jpeg' });
131131
processedUrls.push(url);
132132

133133
res.redirect('/');
@@ -146,7 +146,7 @@ app.listen(APIFY_CONTAINER_PORT, () => {
146146
### [](#final-code) Final code
147147

148148
```JavaScript
149-
import Apify from 'apify';
149+
import { Actor } from 'apify';
150150
import express from 'express';
151151

152152
const app = express()

0 commit comments

Comments
 (0)