How to use the @pulumi/cloud.HttpEndpoint function in @pulumi/cloud

To help you get started, we’ve selected a few @pulumi/cloud examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pulumi / examples / cloud-ts-url-shortener-cache / index.ts View on Github external
// 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`);
github pulumi / pulumi-cloud / examples / integration / index.ts View on Github external
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) =&gt; {

@pulumi/cloud

A highly productive, cloud neutral programming model.

Apache-2.0
Latest version published 10 months ago

Package Health Score

72 / 100
Full package analysis