Back to template gallery

Standby TypeScript project

Template with basic structure for an Actor using Standby mode that allows you to easily add your own functionality.

Language

typescript

Tools

nodejs

Use cases

Starter

src/main.ts

1import http from 'http';
2// Apify SDK - toolkit for building Apify Actors (Read more at https://docs.apify.com/sdk/js/)
3import { Actor } from 'apify';
4
5// this is ESM project, and as such, it requires you to specify extensions in your relative imports
6// read more about this here: https://nodejs.org/docs/latest-v18.x/api/esm.html#mandatory-file-extensions
7// note that we need to use `.js` even when inside TS files
8// import { router } from './routes.js';
9
10// The init() call configures the Actor for its environment. It's recommended to start every Actor with an init()
11await Actor.init();
12
13// Create a simple HTTP server that will respond with a message
14const server = http.createServer((req, res) => {
15    res.writeHead(200, { 'Content-Type': 'text/plain' });
16    res.end('Hello from Actor Standby!\n');
17});
18
19// Listen on the standby port
20server.listen(Actor.config.get('standbyPort'));

Standby TypeScript template

Start a new web scraping project quickly and easily in TypeScript (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.

Included features

Resources

Already have a solution in mind?

Sign up for a free Apify account and deploy your code to the platform in just a few minutes! If you want a head start without coding it yourself, browse our Store of existing solutions.