Adding Routes to ExpressJS App from Modules

Add the hello and world routes like this:

app.use(hello());
world.setup(app);

For some reason, the connect-history-api-fallback module will cause to nothing matched route.

If you comment the code use history middleware:

// app.use(history());

Now, you can access the hello route via https://ncpt4.sse.codesandbox.io/hello and access the world route via https://ncpt4.sse.codesandbox.io/world.

example link: https://codesandbox.io/s/amazing-worker-ncpt4

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top