lambdab

1.0.0 • Public • Published

Lambdab

A wrapper for HTTP lambdas.

How to Use

// HTTP 200 - "Hello World"
module.exports.handler = new Lambdab(function(event) {
    return "Hello World"
})
// HTTP 500 - "Something went wrong." (logs the actual error)
module.exports.handler = new Lambdab(function(event) {
    throw new Error()
})
// HTTP 400 - "Request is not valid JSON"
module.exports.handler = new Lambdab(function(event) {
    throw new Lambdab.UserError("Request is not valid JSON")
})
// One second - HTTP 200 - "Hello World"
module.exports.handler = new Lambdab(async function(event) {
    await new Timeout(1000)
    return "Hello World"
})
Lambdab.headers["Access-Control-Allow-Origin"] = "*"

Body is always JSON-ified.

/lambdab/

    Package Sidebar

    Install

    npm i lambdab

    Weekly Downloads

    5

    Version

    1.0.0

    License

    none

    Unpacked Size

    2.65 kB

    Total Files

    4

    Last publish

    Collaborators

    • ehgoodenough