This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM amazon/aws-lambda-nodejs:14 | |
| ARG handler | |
| COPY ./package.json ./package-lock.json /var/task/ | |
| COPY ./common /var/task/common | |
| COPY ./${handler} /var/task/handler | |
| WORKDIR /var/task | |
| RUN ["npm", "i", "--production"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "date": "2021-05-21T20:09:15.000Z", | |
| "value": 3 | |
| }, | |
| { | |
| "date": "2021-05-21T20:04:40.000Z", | |
| "value": 3 | |
| }, | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ curl -XGET \ | |
| -H "Content-Type: application/json" \ | |
| "http://$API_HOST/events?deviceID=8f188304-e7b3-4a16-a243-b9470468478a&eventType=temp_celcius&date=$(date -u +%F)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "message": "Created event" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ curl -XPOST "http://$API_HOST/events" -H "Content-Type: application/json" -d ' | |
| { | |
| "date": "'$(date -u +%FT%TZ)'", | |
| "deviceID": "8f188304-e7b3-4a16-a243-b9470468478a", | |
| "eventType": "temp_celcius", | |
| "value": 3 | |
| }' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| const microtasks = () => new Promise(res => { | |
| setImmediate(res); | |
| }); | |
| (async () => { | |
| try { | |
| const retrieve = Promise.reject(new Error('No')); | |
| await microtasks(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface Person { | |
| readonly name: string; | |
| age?: number; | |
| } | |
| type WellFormedMutable<T> = { | |
| -readonly[K in keyof T]-?: T[K]; | |
| }; | |
| const p: WellFormedMutable<Person> = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| RouteHandler, | |
| AugmentedRequest, | |
| textResponse, | |
| createRouter, | |
| createRouteMap, | |
| } from "https://deno.land/x/[email protected]/reno/mod.ts"; | |
| import { Status } from "https://deno.land/[email protected]/http/mod.ts"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const concat = <...TInput, ...TItems>( | |
| input: ...TInput, | |
| ...appendees: ...TItems, | |
| ): [...TInput, ...TItems] => [...input, ...appendees]; | |
| const x = concat([1, 2], '3', { no: 4 }); // [1, 2, '3', { no: 4 }] | |
| typeof x; // [number, number, string, { no: number }] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type LogLevel = | |
| | 'debug' | |
| | 'info' | |
| | 'warning' | |
| | 'error'; | |
| type Logger = { | |
| [Level in LogLevel]: (...args: unknown[]) => void; | |
| }; |