Skip to content

Instantly share code, notes, and snippets.

View joandvgv's full-sized avatar

Joan Gil joandvgv

View GitHub Profile
@joandvgv
joandvgv / express-handler.ts
Last active April 25, 2020 17:21
AWS Lambda handler to express
import { Request, Response } from "express";
import { Lambdas, LambdaMap } from "./types";
/**
* Converts an uri with colon-based parameters to brackets-based parameters
* - i.e (:username to {username})
* @param path The url to map
*/
const mapPathToApiGateway = (path: string) => path.replace(/:(.+?)\b/g, "{$1}");
@joandvgv
joandvgv / server.ts
Last active April 25, 2020 17:00
Map API Gateway to an express server
import express from "express";
import * as handlers from "./express-handler";
import { connector } from "swagger-routes-express";
import { apis, apiKeys } from "./constants";
import { getExport } from "./api-gateway";
import { setOperationIds } from "./utils";
import { ApiDefinition } from "./types";
const makeApp = (): express.Express => {
const app = express();
@joandvgv
joandvgv / api-gateway.ts
Created April 25, 2020 16:56
Get Api gateway export from AWS
import * as AWS from "aws-sdk";
AWS.config.region = "us-east-1";
export const getExport = async (restApiId: string) => {
const apiGateway = new AWS.APIGateway();
const parameters = {
exportType: "oas30",
restApiId,
stageName: "v1",
@joandvgv
joandvgv / extensions.json
Last active September 15, 2018 21:47
VsSync
[
{
"id": "jptarquino.postgresql",
"uuid": "da398f66-953d-4be6-adcd-e4344b5ccdec",
"name": "postgresql",
"publisher": "jptarquino",
"version": "0.0.2"
},
{
"id": "zignd.html-css-class-completion",