Created
July 19, 2022 12:58
-
-
Save ajaykarthikr/184184904dc0804e536775103195cd02 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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