| title | Deploying your code to Apify |
|---|---|
| description | In this course learn how to take an existing project of yours and deploy it to the Apify platform as an Actor. |
| sidebar_position | 9 |
| category | apify platform |
| slug | /deploying-your-code |
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
In this course learn how to take an existing project of yours and deploy it to the Apify platform as an Actor.
This section discusses how to use your newfound knowledge of the Apify platform and Actors from the Getting started section to deploy your existing project's code to the Apify platform as an Actor. Any program running in a Docker container can become an Apify Actor.
Apify provides detailed guidance on how to deploy Node.js and Python programs as Actors, but apart from that you're not limited in what programming language you choose for your scraper.
Here are a few examples of Actors in other languages:
Follow these four main steps to turn a piece of code into an Actor:
- Handle accepting inputs and writing outputs.
- Create an input schema (optional).
- Add a Dockerfile.
- Deploy to the Apify platform!
For this section, we'll be turning this example project into an Actor:
// index.js
const addAllNumbers = (...nums) => nums.reduce((total, curr) => total + curr, 0);
console.log(addAllNumbers(1, 2, 3, 4)); // -> 10# index.py
def add_all_numbers (nums):
total = 0
for num in nums:
total += num
return total
print(add_all_numbers([1, 2, 3, 4])) # -> 10:::note Language examples
For all lessons in this section, we'll have examples for both Node.js and Python so that you can follow along in either language.
:::
Next lesson, we'll be learning how to accept input into our Actor as well as deliver output.
