3

I've started learning Meteor.js and it seems fabulous for single page app. But I only know how to create one page for the entire site.

How can I add a static page to http://domain.com and have my Meteor app run at http://domain.com/app? For your solution, will your page actually change when you go to domain.com/app from domain.com?

Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
  • You may also be able to use apache, ngenx, or some other http server to do what you want. Which http server would you choose if you were hosting a static page? Hosting static page at domain.com and meteor app at app.domain.com is very straightforward. – user728291 Jul 29 '13 at 07:12
  • I will choose either nginx and apache to host the static pages. How should it be configured in these cases? – Nyxynyx Jul 29 '13 at 14:54
  • if you are undecided, go with ngenx since it supports websockets. Get your static site working on ngenx. Then follow [instructions](http://stackoverflow.com/a/14976998/728291) to add proxy to the meteor app running on a separate port and accessible by subdomain. – user728291 Jul 29 '13 at 22:39
  • more examples - [here](http://stackoverflow.com/q/16283045/728291), [here](https://gist.github.com/joemccann/644282) – user728291 Jul 29 '13 at 22:47
  • 1
    Sorry for typos on Nginx. At least I was consistent. – user728291 Jul 29 '13 at 22:51

2 Answers2

1

Check out meteor-router. It lets you assign routes to templates.

ram1
  • 6,290
  • 8
  • 41
  • 46
  • 1
    While not released yet, you should be aware of `meteor-iron-router`, a far more flexible router that is being worked on by both people that worked on the past meteor routers. – Andrew Mao Jul 26 '13 at 22:24
  • iron router ftw. use that. – Mustafa Dec 04 '14 at 10:12
  • As of June 2015, [flow-router](https://forums.meteor.com/t/should-i-be-using-iron-router-or-is-it-dying/4540) is starting to be preferred vs. iron-router. – Dan Dascalescu Jun 22 '15 at 08:29
1

If you dont mind calling a html file you can have static pages in /public. This probably wont work for you, because your page probably isnt actually a "static" page. This would be accessed at http://mydomain.com/index.html .

eg, /public/index.html :

<html>
    <head>
        <link href="/public/index.css rel="stylesheet">
    </head>
    <body>
        <h1 class="something"> I am a web page </h1>
    </body>
</html>
Mike Graf
  • 5,077
  • 4
  • 45
  • 58