I have an express app and is deployed via serverless. My stack is just a lambda function + API Gateway. That works and it's accessible on Postman or httpxmlrequest. But if I take out API Gateway piece from the stack, is it possible to still invoke this lambda function using the AWS SDK/cli, somehow do routing by passing in a path (eg: /books)
and a method (eg: POST)
together with the payload?
I'm new to the AWS ecosystem... just started using serverless + node.
Say I have a simple express app like so:
const serverless = require('serverless-http');
const express = require('express');
const bodyParser = require('body-parser');
const helpersRoute = require('./routes');
const booksRoute = require('./routes/books');
const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use('/', helpersRoute);
app.use('/books', booksRoute);
module.exports.handler = serverless(app);
And this is my serverless config:
service: service-test
provider:
name: aws
runtime: nodejs8.10
stage: dev
functions:
app:
handler: index.handler