My Actor avatar
My Actor

Under maintenance

Pricing

Pay per usage

Go to Store
My Actor

My Actor

Under maintenance

Developed by

Emmanuel Osuolale

Maintained by Community

0.0 (0)

Pricing

Pay per usage

0

Monthly users

1

Last modified

2 years ago

.actor/Dockerfile

1# Specify the base Docker image. You can read more about
2# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
3# You can also use any other image from Docker Hub.
4FROM apify/actor-node:16
5
6# Copy just package.json and package-lock.json
7# to speed up the build using Docker layer cache.
8COPY package*.json ./
9
10# Install NPM packages, skip optional and development dependencies to
11# keep the image small. Avoid logging too much and print the dependency
12# tree for debugging
13RUN npm --quiet set progress=false \
14    && npm install --omit=dev --omit=optional \
15    && echo "Installed NPM packages:" \
16    && (npm list --omit=dev --all || true) \
17    && echo "Node.js version:" \
18    && node --version \
19    && echo "NPM version:" \
20    && npm --version \
21    && rm -r ~/.npm
22
23# Next, copy the remaining files and directories with the source code.
24# Since we do this after NPM install, quick build will be really fast
25# for most source file changes.
26COPY . ./
27
28
29# Run the image.
30CMD npm start --silent

.actor/actor.json

1{
2    "actorSpecification": 1,
3    "name": "getting-started-node",
4    "title": "Getting Started with Node.js",
5    "description": "Adds two integers.",
6    "version": "0.0",
7    "meta": {
8        "templateId": "js-start"
9    },
10    "input": "./input_schema.json",
11    "dockerfile": "./Dockerfile",
12    "storages": {
13        "dataset": {
14            "actorSpecification": 1,
15            "title": "Numbers and their sums",
16            "views": {
17                "sums": {
18                    "title": "A sum of two numbers",
19                    "transformation": {
20                        "fields": [
21                            "sum",
22                            "firstNumber",
23                            "secondNumber"
24                        ]
25                    },
26                    "display": {
27                        "component": "table",
28                        "properties": {
29                            "sum": {
30                                "label": "Sum",
31                                "format": "number"
32                            },
33                            "firstNumber": {
34                                "label": "First number",
35                                "format": "number"
36                            },
37                            "secondNumber": {
38                                "label": "Second number",
39                                "format": "number"
40                            }
41                        }
42                    }
43                }
44            }
45        }
46    }
47}

.actor/input_schema.json

1{
2  "title": "Add two integers",
3  "type": "object",
4  "schemaVersion": 1,
5  "properties": {
6    "firstNumber": {
7      "title": "First integer",
8      "type": "integer",
9      "description": "The number you want to add to the second number.",
10      "editor": "number"
11    },
12    "secondNumber": {
13      "title": "Second integer",
14      "type": "integer",
15      "description": "The number you want to add to the first number.",
16      "editor": "number"
17    }
18  },
19  "required": ["firstNumber", "secondNumber"]
20}

src/main.js

1const Apify = require('apify');
2
3Apify.main(async () => {
4    const { clientIp } = Apify.getInput();
5    await Apify.setValue('OUTPUT', { ip: clientIp });
6});

.dockerignore

1# configurations
2.idea
3
4# crawlee and apify storage folders
5apify_storage
6crawlee_storage
7storage
8
9# installed files
10node_modules
11
12# git folder
13.git

package.json

1{
2    "name": "getting-started-node",
3    "version": "0.0.1",
4    "type": "module",
5    "description": "This is an example of an Apify actor.",
6    "dependencies": {
7        "apify": "^3.0.0"
8    },
9    "devDependencies": {},
10    "scripts": {
11        "start": "node src/main.js",
12        "test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
13    },
14    "author": "It's not you it's me",
15    "license": "ISC"
16}

Pricing

Pricing model

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage.