Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions waspc/data/Generator/templates/server/src/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@ const router = express.Router()
const middleware = globalMiddlewareConfigForExpress()

router.get('/', middleware, function (_req, res) {
{=# isDevelopment =}
res.json({
message: 'Wasp Server is up and running!',
note: 'This is the Wasp server API. If you are looking for the web app, it is running on a separate port (usually 3000).',
documentation: 'https://wasp-lang.dev/docs'
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some thoughts:

  • It's JSON in dev, and an empty (I presume text) response in production - some people might make some assumption and try to parse it in production for their healthcheck? Maybe we stick with text here?
  • We intentionally removed the body on this endpoint because people complained it's less professional - they might again assume the prod response will look the dev response - we might point out that this is a dev only message?
Suggested change
res.json({
message: 'Wasp Server is up and running!',
note: 'This is the Wasp server API. If you are looking for the web app, it is running on a separate port (usually 3000).',
documentation: 'https://wasp-lang.dev/docs'
});
res.json({
message: 'This is the Wasp server (development)',
note: 'This is the Wasp server API. If you are looking for the web app, check the logs for Vite... You are seeing this message because the serve is running in develpoment mode, this will disappear when in production.',
documentation: 'https://wasp-lang.dev/docs'
});

I butchered it but I think you get the point I was trying to make

{=/ isDevelopment =}
{=^ isDevelopment =}
res.status(200).send();
{=/ isDevelopment =}
})

{=# isAuthEnabled =}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion waspc/src/Wasp/Generator/ServerGenerator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ genRoutesIndex spec =
"crudRouteInRootRouter" .= (CrudRoutes.crudRouteInRootRouter :: String),
"isAuthEnabled" .= (isAuthEnabled spec :: Bool),
"areThereAnyCustomApiRoutes" .= (not . null $ AS.getApis spec),
"areThereAnyCrudRoutes" .= (not . null $ AS.getCruds spec)
"areThereAnyCrudRoutes" .= (not . null $ AS.getCruds spec),
"isDevelopment" .= (not $ AS.isBuild spec :: Bool)
]

operationsRouteInRootRouter :: String
Expand Down