JavaScript API Actor
An Actor that stays running, ready to respond to HTTP requests. Good for APIs and real-time services.
src/main.js
1import http from 'node:http';2
3// Apify SDK - toolkit for building Apify Actors (Read more at https://docs.apify.com/sdk/js/)4import { Actor } from 'apify';5
6// this is ESM project, and as such, it requires you to specify extensions in your relative imports7// read more about this here: https://nodejs.org/docs/latest-v18.x/api/esm.html#mandatory-file-extensions8// import { router } from './routes.js';9
10// The init() call configures the Actor to correctly work with the Apify-provided environment - mainly the storage infrastructure. It is necessary that every Actor performs an init() call.11await Actor.init();12
13// Create a simple HTTP server that will respond with a message14const server = http.createServer((req, res) => {15 // Handle Apify standby readiness probe16 // https://docs.apify.com/platform/actors/development/programming-interface/standby#readiness-probe17 if (req.headers['x-apify-container-server-readiness-probe']) {18 res.writeHead(200);19 res.end('ok');20 return;21 }22 res.writeHead(200, { 'Content-Type': 'text/plain' });23 res.end('Hello from Actor Standby!\n');24});25
26// Listen on the standby port27server.listen(Actor.config.get('standbyPort'));Start a new web scraping project quickly and easily in JavaScript (Node.js) with our Standby project template. It provides a basic structure for building an Actor with Apify SDK and allows you to easily add your own functionality.
JavaScript site crawler (Crawlee + Cheerio)
A fast crawler that follows links and gets data from static pages, with Crawlee handling retries, queues, and proxies. Good for blogs, news, or product listings, but it can't run client-side JavaScript.
JavaScript one-page scraper (Cheerio)
A scraper that gets data from one web page with Cheerio. The simplest way to start scraping.
JavaScript browser crawler (Crawlee + Puppeteer + Chrome)
A browser crawler that renders JavaScript in headless Chrome, with Crawlee handling retries, queues, and proxies. Good for social feeds, dashboards, or single-page apps.
JavaScript browser crawler (Crawlee + Playwright + Chrome)
A browser crawler that renders JavaScript, with Crawlee handling retries, queues, and proxies. Good for social feeds, dashboards, or single-page apps.
JavaScript stealth crawler (Crawlee + Playwright + Camoufox)
A browser crawler built to get past bot protection. Uses Camoufox, a Firefox build that looks like a real user.
JavaScript minimal site crawler (Crawlee + Cheerio)
A minimal site crawler for developers who already know the Apify SDK and Crawlee.