-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.js
More file actions
28 lines (23 loc) · 784 Bytes
/
main.js
File metadata and controls
28 lines (23 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// main.js
const { Actor } = require("apify");
const { default: axios } = require("axios");
Actor.main(async () => {
try {
// 1. Get input from Apify task / API
const input = await Actor.getInput();
console.log("Received input:", input);
// 2. Call your external API
const res = await axios.post("https://api.orgupdate.com/search-jobs-v1", {
...input,
source: "linkedin",
});
const jobs = res.data;
// 3. Store results into Apify dataset
await Actor.pushData(jobs);
console.log(`✅ Saved ${jobs.length || 0} jobs to dataset`);
// Actor ends automatically when main() resolves
} catch (err) {
console.error("❌ Job search failed:", err.message);
throw err; // Actor will be marked as FAILED in console
}
});