Skip to content

Instantly share code, notes, and snippets.

View mr-pascal's full-sized avatar

Pascal mr-pascal

View GitHub Profile
import fetch from 'node-fetch';
import {JSDOM} from 'jsdom';
/**
* Small wrapper method for getting the actual HTML content of a website
* @param {string} url The URL to get the HTML for
* @return {Promise<string>} The HTML content as string
*/
const getWebsiteContent = async (url: string): Promise<string> => {
// Simple HTTP call
## create-sa.sh
#### Variables
SERVICE_ACCOUNT_ID="customer-1"
PROJECT_ID="my-medium-demo-project-299218"
SA_DESCRIPTION="Customer 1 description"
SA_DISPLAY_NAME="Customer 1"
ROLE_NAME="roles/cloudfunctions.invoker"
####
## create-sa-key.sh
#### Variables
SERVICE_ACCOUNT_ID="customer-1"
PROJECT_ID="my-medium-demo-project-299218"
####
### Create private key for service account
gcloud iam service-accounts keys create ~/key.json \
--iam-account "$SERVICE_ACCOUNT_ID@$PROJECT_ID.iam.gserviceaccount.com"
// part of external-service/index.ts
/**
* 1. Define a GET endpoint with the url "/ping"
*/
app.get('/ping', async (request, reply) => {
// Just rename global variable for ease of use
const url: string = cloudFunctionEndpoint;
.gitignore
.dockerignore
Dockerfile
build
node_modules
README.md
# Name the node stage "builder"
FROM node:15-alpine AS builder
# Set working directory
WORKDIR /app
# Copy our node module specification
COPY package.json package.json
COPY yarn.lock yarn.lock
# Name the node stage "builder"
FROM node:15-alpine AS builder
# Set working directory
WORKDIR /app
# Copy our node module specification
COPY package.json package.json
COPY yarn.lock yarn.lock
server {
# $PORT will be provided by 'docker run'
listen $PORT;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri /index.html;
}
# Name the node stage "builder"
FROM node:15-alpine AS builder
# Set working directory
WORKDIR /app
# Copy our node module specification
COPY package.json package.json
COPY yarn.lock yarn.lock
node_modules
build
README.md
.gitignore
deploy.sh