Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
import * as pulumi from "@pulumi/pulumi";
import * as cloud from "@pulumi/cloud";
import * as cache from "./cache";
// Create a web server.
let endpoint = new cloud.HttpEndpoint("urlshortener");
// Create a table `urls`, with `name` as primary key.
let urlTable = new cloud.Table("urls", "name");
// Create a cache of frequently accessed urls.
let urlCache = new cache.Cache("urlcache");
// Serve all files in the www directory to the root.
endpoint.static("/", "www");
// GET /url lists all URLs currently registered.
endpoint.get("/url", async (req, res) => {
try {
let items = await urlTable.scan();
res.status(200).json(items);
console.log(`GET /url retrieved ${items.length} items`);
export function exampleSendSESEmail() {
let api = new cloud.HttpEndpoint("sadsad");
api.get("/", async (req, res) => {
try {
await sendSESEmail({
to: ["luke@pulumi.com"],
bcc: ["inquiries@pulumi.com"],
replyTo: ["inquiries@pulumi.com"],
source: "\"Pulumi\" ",
subject: "Hi from Pulumi",
bodyHtml: "Hello, welcome to <b>Pulumi</b>.",
});
res.json({});
} catch (err) {
res.status(500).json(err);
}
});
api.get("/insertSalesforce", async (req, res) => {