Remove /cloud from readme. (#3010)
This commit is contained in:
parent
653501758d
commit
0ee75d2201
21
README.md
21
README.md
|
@ -45,16 +45,23 @@ for (let i = 0; i < 3; i++) {
|
||||||
Or a simple serverless timer that archives Hacker News every day at 8:30AM:
|
Or a simple serverless timer that archives Hacker News every day at 8:30AM:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
const cloud = require("@pulumi/cloud");
|
const aws = require("@pulumi/aws");
|
||||||
const snapshots = new cloud.Table("snapshots");
|
|
||||||
cloud.timer.daily("daily-yc-snapshot", { hourUTC: 8, minuteUTC: 30 }, () => {
|
const snapshots = new aws.dynamodb.Table("snapshots", {
|
||||||
const req = require("https").get("https://news.ycombinator.com", res => {
|
attributes: [{ name: "id", type: "S", }],
|
||||||
|
hashKey: "id", billingMode: "PAY_PER_REQUEST",
|
||||||
|
});
|
||||||
|
|
||||||
|
aws.cloudwatch.onSchedule("daily-yc-snapshot", "cron(30 8 * * ? *)", () => {
|
||||||
|
require("https").get("https://news.ycombinator.com", res => {
|
||||||
let content = "";
|
let content = "";
|
||||||
res.setEncoding("utf8");
|
res.setEncoding("utf8");
|
||||||
res.on("data", chunk => content += chunk);
|
res.on("data", chunk => content += chunk);
|
||||||
res.on("end", () => snapshots.insert({ date: Date.now(), content }));
|
res.on("end", () => new aws.sdk.DynamoDB.DocumentClient().put({
|
||||||
});
|
TableName: snapshots.name.get(),
|
||||||
req.end();
|
Item: { date: Date.now(), content },
|
||||||
|
}).promise());
|
||||||
|
}).end();
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue