-
Notifications
You must be signed in to change notification settings - Fork 47
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
Path not found for reload #56
Comments
You need to include this |
I've added that in as well. When I restart the server, I get this message. GET /reload/reload.js 404 13.711 ms - 1963. It never creates the endpoint for reload for me. |
You installed, required, and called reload correctly in you |
Yes. I ran npm install --save reload. Inside my www file, it looks like this: /**
var port = normalizePort(process.env.PORT || '3000'); /**
var server = http.createServer(app); reload(server, app); /**
server.listen(port); Inside my index.ejs file, it looks like this: |
Looks alright. Are you able to upload it to a test repo, so I can check it out? |
I will do that for you and give you the details |
Any ideas? |
Busy weekend, will check it out tonight for you. |
i have this problem, too |
Sorry I've been busy, I will make it a point to check it out for you both this weekend |
@dadixon I went to check out your repo and the link is dead. @Eamonnzhang Can you provide more details? |
I have this problem too, and I solved it by adding my own route for reload.js in my app. I think the problem occurs when reload is invoked after a 404 route has already been set up, so the app never gets to the route for /reload/reload.js added by the reload module. I suggest this could be fixed by separating the route code in the module out into another method which would be exposed by the module. Then the default method could take a parameter to include the route as it does now. We could then call the route generator method manually in a suitable place with out other routes if necessary. |
@spikyjt Can confirm, I had the above problem in a vanilla express project and after commenting the 404 route reload.js loads.
|
@spikyjt and @100000001 off the top of my head the only thing I can think of is that reload is being defined too late. For example 404 routes have to be defined last in Express, this is a limitation of Express itself not reload. If you still believe there is a problem can you provide a sample app that I can look it. |
The way I have middleware setup also makes it difficult for the same reason. I totally understand why you have done it the way you have for the most convenient case. In the middleware chain I have, there is no good place where server and app are available together at a point where the routing can be changed. All the middleware for the app is setup in advance including the error handling and this is a separate module. This module is then required by the serving module, which decides whether it should start an HTTP or HTTPS server for the app. Is it possible to separate out where the route is added so that I can do it in two steps? So I would have to add code in two places for reload to work in this way: during routing: then another function that wouldn't need the app: I think the module would need another way to instantiate so it wasn't always returning the single function. I can put together a PR if you think it is feasible to include it? |
For anyone else interested I got it working like this in version 1.1.1: In my routing before the error handling:
On every page:
When the app is served:
|
@peterwillis I see you are doing server side injection of the reload file. Something we have been wanting to add (issue #12). @peterwillis on your original comment what was going on. A lot of people have been talking about problems like this and we would like to solve it. A provided sample app would be even more helpful. |
Which point you are asking for a sample for? Would you like to see why it is a problem in my app, or an example of the workaround? |
@peterwillis I would like to see how it is a problem in your app. |
@peterwillis I moved this to a new issue (#67) since it was something somewhat separate from this issue |
@alallier Is this still an issue? |
Yeah I re-read this I think it is safe to close given the conversation in this thread. We dopped support for server and just support app now. If for anyone is this thread tries out v2.x and still is having trouble, let me know and I will re-open |
I've started a node.js and express.js project and installed reload but I can't get the path for the script to work correctly.
`var server = http.createServer(app);
reload(server, app);`
that's in my www.js file.
when I try to point to the endpoint /reload/reload.js, I get a 404 error message
The text was updated successfully, but these errors were encountered: