Meteor 3rd party server routes not found

I am running Meteor on OS X 10.6.8 and earlier today I installed IronRouter via meteor add iron:router

so I must have the latest version.

I have this in my routes file:

    function () {
        var req = this.request;
        var res = this.response;
        res.end('hello from the server\n');
    , {where: 'server'}


When I click this url:

http: // localhost: 3000 / create_profile

I get a message in the browser:

Alas, it looks like there is no path on the client or server for the URL: " http: // localhost: 3000 / create_profile .

If I delete , {where: 'server'}

then it works. Any suggestions what I should be looking for?


source to share

2 answers

Juan's answer is not wrong, but he is not honoring the agreement, and he does not explain why what you did is wrong.

TL; DR; Define your routes inside lib/routes.js


Server side route is the route where you serve the content loading meteor on the client. In your example, you are just executing a piece of text. The code inside client/

is executed on the client side. This means that it only works on the client after meteor downloads. So when your server route is determined, the meteorite is already loaded.

The iron router is somewhat isomorphic. This means that the same API is available to you on both the client and the server. Therefore Iron assumes that the routes are defined in the general code (for example, inside lib/

). When you set the option where

to server

, the hardware will ignore the route when the code is run on the client side. When this code runs on the test server, the hardware installs what is called connectHandlers

. It uses the API WebApp.connectHandlers.use

. These handlers allow you to bypass the meteor core feed.

When you don't load the Meteor core, your client-side code is not executed, and the generic code is only executed on the server.



At the heart of your comment:

Change your routes.js file to the shared directory,


you can read more about how to structure your application in the official documentation



All Articles