Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Custom Route Example Code does not work #1471

Closed
emsesc opened this issue Feb 3, 2021 · 5 comments
Closed

HTTP Custom Route Example Code does not work #1471

emsesc opened this issue Feb 3, 2021 · 5 comments

Comments

@emsesc
Copy link

emsesc commented Feb 3, 2021

Bug Report

Current Behavior
When placing the example code from the documentation in index.js and navigating to https://localhost:3000/my-app/hello-world, there is no response. A GET request from Postman also does not work.

module.exports = (app, { getRouter }) => {
  // Get an express router to expose new HTTP endpoints
  const router = getRouter("/my-app");

  // Use any middleware
  router.use(require("express").static("public"));

  // Add a new route
  router.get("/hello-world", (req, res) => {
    res.send("Hello World");
  });
};

Expected behavior/code
When navigating to the page: https://localhost:3000/my-app/hello-world to access the endpoint, the server should respond with "Hello World."

Environment

  • Probot version(s): v11.0.5
  • Node/npm version: v14.15.4
  • OS: Windows 10

Possible Solution

None.

Additional context/Screenshots

Log output:

> probot run ./index.js

INFO     (server): Running Probot v11.0.5 (Node.js: v14.15.4)
INFO     (server): Forwarding https://smee.io/xxxxx to http://localhost:3000/
INFO     (server): Listening on http://localhost:3000
INFO     (server): Connected
@welcome
Copy link

welcome bot commented Feb 3, 2021

Thanks for opening this issue. A contributor should be by to give feedback soon. In the meantime, please check out the contributing guidelines and explore other ways you can get involved.

@emsesc emsesc changed the title HTTP Custom Route Example Code HTTP Custom Route Example Code does not work Feb 3, 2021
@gr2m
Copy link
Contributor

gr2m commented Feb 3, 2021

Can you share the log output from your server?

@emsesc
Copy link
Author

emsesc commented Feb 5, 2021

@gr2m Added the log output in the issue 👍

@gr2m
Copy link
Contributor

gr2m commented Feb 5, 2021

I tried to reproduce the problem but to no avail, it works as documented for me

image

$  LOG_LEVEL=trace npx probot run ./debug.js
INFO (server): Running Probot v11.0.6 (Node.js: v14.15.4)
INFO (server): Forwarding https://smee.io/Xs7emdfD6u2i7Svz-wip-production to http://localhost:3000/
INFO (server): Listening on http://localhost:3000
INFO (server): Connected
INFO (http): GET /hello-world 304 - 7ms
INFO (http): GET /hello-world 200 - 1ms
INFO (http): GET /favicon.ico 404 - 2ms

It might be a windows problem, unfortunately I don't have a windows machine to test with myself

@emsesc
Copy link
Author

emsesc commented Feb 5, 2021

Turned out to be an issue with my computer - I restarted my machine and it works now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants