From a36718e9019b05a9f88d33024c2b561f2ca79c2b Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Sat, 16 May 2020 20:44:25 +0900 Subject: [PATCH] rename to echo --- api/{app.js => echo.js} | 0 index.js | 6 ++++-- vercel.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) rename api/{app.js => echo.js} (100%) 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" }] }