forked from suxinjie/flomo-reminder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
30 lines (21 loc) · 744 Bytes
/
Copy pathindex.ts
File metadata and controls
30 lines (21 loc) · 744 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
29
30
function errorHandler(error: Error) {
console.error(error);
process.exit(1);
}
process.on("uncaughtException", errorHandler);
process.on("unhandledRejection", errorHandler);
import * as dotenv from "dotenv";
dotenv.config();
import { ApiService } from "./service/ApiService";
import { MemoService } from "./service/MemoService";
import { PushService } from "./service/PushService";
async function main() {
const apiService = new ApiService();
const memoService = new MemoService();
const pushService = new PushService();
const memos = await apiService.getMemos();
const luckyMemo = memoService.getLuckyMemo(memos);
console.log("The lucky memo is: \r\n\r\n", luckyMemo, "\r\n");
pushService.push(luckyMemo);
}
main();