Skip to content

Introduce app object and routing #1

@tomas-polach

Description

@tomas-polach

Currently, there is no app object and the use method is called directly:

const { use } = require('lambda-expressless');
const bodyParser = require('body-parser');

exports.handler = use(bodyParser.json(), (req, res) => {
  res.status(201).json({
    success: false,
    data: req.body.id
  })
});

Proposal: Add a workflow using the app object, compatible with Express way of handling middleware and routing:

const Expressless = require('lambda-expressless');
const bodyParser = require('body-parser');

const app = Expressless()

app.use(bodyParser.json())
app.use('/do-it', authenticate, doIt)
app.use('/do-other-stuff', authenticate, doOtherStuff)
app.use(handleErrors)

exports.handler = app.apiGatewayHandler

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions