MeteorJS和Iron:WebSocket出现路由器错误

时间:2015-06-18 16:43:10

标签: meteor iron-router

我在Windows 8.1上使用MeteorJS和Iron:路由器,我创建了一个简单的流星项目,并添加了Iron:路由器库,然后复制一个示例(Router Controller)但它抛出了这个错误。

layot.html

<head>
  <title>route_controllers</title>
</head>

<body>
</body>

<template name="AppLayout">
  <div class="container">
    <nav>
      <ul>
        <li><a href="/posts">/posts</a></li>
      </ul>
    </nav>
    <article>
      {{> yield}}
    </article>
  </div>
</template>

<template name="Home">
  <h1>Home</h1>
</template>

<template name="PostIndex">
  <h1>Post Index</h1>
</template>

layout.js

Router.route('/', {
  name: 'home'
});

Router.route('/posts', {
  controller: 'PostController',
  action: 'index'
});

if (Meteor.isClient) {
  ApplicationController = RouteController.extend({
    layoutTemplate: 'AppLayout',

    onBeforeAction: function () {
      this.next();
    },
  });

  HomeController = ApplicationController.extend({
    action: function () {
      this.render('Home');
    }
  });

  PostController = ApplicationController.extend({
    index: function () {
      this.render('PostIndex');
    }
  });
}

console.error:

 WebSocket connection to 'ws://localhost:3000/sockjs/034/68ih8b52/websocket' failed: Error during WebSocket handshake: Invalid status line

0 个答案:

没有答案