My Actor avatar
My Actor

Under maintenance

Pricing

Pay per usage

Go to Store
My Actor

My Actor

Under maintenance

Developed by

Emmanuel Osuolale

Emmanuel Osuolale

Maintained by Community

0.0 (0)

Pricing

Pay per usage

0

Total users

1

Monthly users

1

Last modified

2 years ago

.actor/Dockerfile

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

.actor/actor.json

{
"actorSpecification": 1,
"name": "getting-started-node",
"title": "Getting Started with Node.js",
"description": "Adds two integers.",
"version": "0.0",
"meta": {
"templateId": "js-start"
},
"input": "./input_schema.json",
"dockerfile": "./Dockerfile",
"storages": {
"dataset": {
"actorSpecification": 1,
"title": "Numbers and their sums",
"views": {
"sums": {
"title": "A sum of two numbers",
"transformation": {
"fields": [
"sum",
"firstNumber",
"secondNumber"
]
},
"display": {
"component": "table",
"properties": {
"sum": {
"label": "Sum",
"format": "number"
},
"firstNumber": {
"label": "First number",
"format": "number"
},
"secondNumber": {
"label": "Second number",
"format": "number"
}
}
}
}
}
}
}
}

.actor/input_schema.json

{
"title": "Add two integers",
"type": "object",
"schemaVersion": 1,
"properties": {
"firstNumber": {
"title": "First integer",
"type": "integer",
"description": "The number you want to add to the second number.",
"editor": "number"
},
"secondNumber": {
"title": "Second integer",
"type": "integer",
"description": "The number you want to add to the first number.",
"editor": "number"
}
},
"required": ["firstNumber", "secondNumber"]
}

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

# configurations
.idea
# crawlee and apify storage folders
apify_storage
crawlee_storage
storage
# installed files
node_modules
# git folder
.git

package.json

{
"name": "getting-started-node",
"version": "0.0.1",
"type": "module",
"description": "This is an example of an Apify actor.",
"dependencies": {
"apify": "^3.0.0"
},
"devDependencies": {},
"scripts": {
"start": "node src/main.js",
"test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
},
"author": "It's not you it's me",
"license": "ISC"
}