Created
June 1, 2020 10:32
-
-
Save kukielp/a7be92041c70b316cd9ec8fcf3402db8 to your computer and use it in GitHub Desktop.
This file contains 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 { | |
APIGatewayProxyEvent, | |
APIGatewayProxyResult, | |
Context | |
} from "https://deno.land/x/lambda/mod.ts"; | |
export async function handler( | |
event: APIGatewayProxyEvent, | |
context: Context | |
): Promise<APIGatewayProxyResult> { | |
return { | |
statusCode: 200, | |
headers: { "Content-Type": "text/json" }, | |
body: JSON.stringify(constructResponse(event)), | |
}; | |
} | |
class Person { | |
private _fullName: string; | |
get fullName(): string { | |
return this._fullName + '!'; | |
} | |
constructor(firstName: string, ) { | |
this._fullName = firstName; | |
} | |
} | |
class Result { | |
user: Person; | |
message: string; | |
constructor(u: Person, m: string){ | |
this.message = m; | |
this.user = u; | |
} | |
} | |
const constructResponse = (event: APIGatewayProxyEvent) => { | |
let name = event.path.replace("/",""); | |
let p = new Person(name); | |
let r = new Result(p, `Hi ${p.fullName}, Welcome to deno ${Deno.version.deno} 🦕`); | |
return r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment