diff --git a/api/app.js b/api/echo.js similarity index 100% rename from api/app.js rename to api/echo.js diff --git a/index.js b/index.js index 668bd02..307a09e 100644 --- a/index.js +++ b/index.js @@ -29,6 +29,8 @@ app.use(express.urlencoded({ extended: false })); app.use(express.raw({ type: "*/*" })); app.set("json spaces", 2); app.all("/basic-auth", passport.authenticate("basic", { session: false })); -app.all("/*", require("./api/app.js")); +app.all("/*", require("./api/echo.js")); -app.listen(process.env.PORT || 8080); +if (require.main === module) app.listen(process.env.PORT || 8080); + +module.exports = app; diff --git a/vercel.json b/vercel.json index 0eefc00..575dce4 100644 --- a/vercel.json +++ b/vercel.json @@ -1,4 +1,4 @@ { "version": 2, - "routes": [{ "src": "/.*", "dest": "/api/app.js" }] + "routes": [{ "src": "/.*", "dest": "/api/echo.js" }] }