Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ajaykarthikr/184184904dc0804e536775103195cd02 to your computer and use it in GitHub Desktop.
Save ajaykarthikr/184184904dc0804e536775103195cd02 to your computer and use it in GitHub Desktop.
const serverless = require("serverless-http");
const express = require("express");
const app = express();
app.get("/", (req, res, next) => {
return res.status(200).json({
message: "Hello from root!",
});
});
app.get("/hello", (req, res, next) => {
return res.status(200).json({
message: "Hello from path!",
});
});
app.use((req, res, next) => {
return res.status(404).json({
error: "Not Found",
});
});
module.exports.handler = serverless(app);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment