New end points added to server.js not getting called.

In short all I want to do is add a new route to the sample project, I have some experience with node and express apps, but for the life of me I cannot understand why when I add a new route, like this :

expressApp.get(’/exit’, function (req, res, next) {
// res.send(“hello”);

I’m getting a 404 not found when i run the server And refresh in my browser.

I’ve tried all of the obvious things, but I’m definitely not hitting the endpoint, which makes me think I have to add any new route I want to define somewhere else in the codebase, But alas I cannot seem to find where I would add this, Has anyone got an idea how I can do this? Appreciate this is a very basic question but I am at my wits end and I really don’t know what the issue could be.

You have here the http express routes defined in the demo.

You might be calling the wrong url :man_shrugging: Without the src code its all a guess.

1 Like

Okay I’ll challenge you to see if it works for you. If you go to the demo project and set it up on your server, amending the config, and adding your certificates. Then add this route :

		async (req, res, next) =>
		{'">>>> WE HIT THE OLD GIRL"');

Every single time without fail I am getting >> Cannot GET /rooms/hello

I am wondering if there is something that happens when i run NPM start that in some way removes the routes i am adding ? I have researched this point and i cannot see how that (or gulp) could be doing that or altering the server in terms of the routes in any way. Any ideas? Please i am so lost on this.

Someone else must have had this problem. I am running on ubuntu 18.0

This is not the most polite way to ask for help. If you have a problem you cannot solve, that’s not a “challenge” for others, neither the fact that you have a problem you cannot solve means that “someone else must have had this problem”.

BTW this is not a question about mediasoup-demo but a pure question about Express.js. You are trying to add a new route at /rooms/hello that may generate a conflict with the already existing /rooms/:roomId routes (which may take preference). Replace /rooms/hello with /foo/bar and it will work for you.

All points taken from the above, and I am sorry I did not mean for that to come across in the way that it did. I hope you can forgive me for that, reading it back I understand why you raise the issue you do. I’m very grateful for
any suggestions that can help me.

I have attempted to make the adjustments, to identify whether there was a route conflict in some fashion, however that does not seem to resolve it for me. I am now getting >> >> Cannot GET /foo/bar

It’s so odd as absolutely everything else about the mediasoap demo works flawlessly, it is only when I try and add another route that I run into this issue. Ive looked into Express (i have used it before) and there isnt anything i can see that would mean that a route would not be accessible.

Is there anything in the front end that means all requests must come from the js running in the web browser, such that any request not issued from the js app (mediasoap-demo-app.js) is not resolvable?

Im so sorry i am just so flummoxed with what i am seeing.

No, there is nothing like that. It’s a super simple express.js logic. Maybe you are contacting the proper server http port.

Sadly, I checked that, as I say I’m able to hit all of the other end points The demo exposes, only the one that I add fails to be resolved. I’ve tried restarting my EC2 instance in case there was an issue there, and have taken a fresh copy of the demo Repository, and made the adjustment there (adding the route I mentioned above) but still the request fails. Believe me I am as bemused as you are, because there is absolutely nothing I can think of that would prevent this route not working. It’s like it is being ignored as part of the process when running npm start, but I’ve never had that happened to me before in any other project I’ve worked on using express, so I am literally out of ideas. I should also say this is a vanilla EC2 instance, with no fancy firewall rules set up to prevent certain routes being accessible.

I don’t know what to say. I’ve just added a single GET /exit route and it works:

	'/exit', (req, res) =>
		res.status(200).send('EXIT DONE');

 * API GET resource that returns the mediasoup Router RTP capabilities of
 * the room.
	'/rooms/:roomId', (req, res) =>
		const data =;

$ curl
Error: room with id "123" not found

$ curl