Application using Node js, express js and mongo db

Anybody working example using node js, express js and mongo db? I have tried many links and most of them are raising errors.

The application must involve insert, update, delete, select operations of database.

Does it have to use ExpressJS? You generally don’t need it when using Serverless.

A quick search of the examples repo shows up aws-node-rest-api-with-dynamodb, which sounds like what you’re trying to do.

Your other option would be to take an ExpressJS example application, and migrating it to Lambda as described in this blog post. This uses the aws-serverless-express library from AWS Labs.

Another item to consider, lambda does not have any ‘state’ or lifcycle events to know when your container is being shut down. This means connection pooling is not really an option and external solutions like MySQL or MongoDB for time sensitive operations (sub 1 second). As a result you have to have some sort of intermediary like RESTHeart between your lambda functions and MongoDB, which gives you performance, but then adds a huge complication (relatively) in your scalability since EC2 now needs to be addressed.

So using DynamoDB or S3 as your data source might make a lot more sense. Its worth noting, that S3 only works for basic CRUD operations by key, not querying, unless you get clever and make use of elastic search or some other intermediary, which again introduces scalability concerns. S3 does have the benefit of being incredibly fast though, faster than DynamoDB in all my tests.