Deploying an Express API easily on AWS Lambda

Learn the least expensive way to host your Express API

AWS Lambda with Serverless Framework

Setting up

yarn global add serverless
serverless config credentials --provider aws --key access-key-here --secret secret-key-here

Preparing our repo

serverless init express-starter
cd express-starter
{"name": "src","version": "1.0.0","description": "","main": "app.js","dependencies": {"express": "^4.17.1"},"devDependencies": {},"scripts": {"dev": "serverless dev","deploy": "serverless deploy  --stage prod"},"author": "","license": "ISC"}
"use strict";const express = require("express");const app = express();// Routesapp.get("/*", (req, res) => res.json({ message: "Hello world" }));// Error handlerapp.use((err, req, res, next) => {   console.error(err);   res.status(500).send("Internal Serverless Error");});module.exports = app;


💻 💻 Software Engineer at @filevine . 📖 📖 Instructor for @udacity . ✍️ ✍️ Writer at