Route not defined


#1

There is something wrong the Flowrouter.route function i my application here is mye filestructure:

here is mye routes.jsx file:

import React from 'react';
import {mount} from 'react-mounter';


import Layout from './components/MainLayout.jsx';
import ItemsList from '../items/components/ItemsList.jsx';

export default function (injectDeps, {FlowRouter}) {
    const MainLayoutCtx = injectDeps(Layout);
    console.log(FlowRouter)

    FlowRouter.route('/', {
    name: 'items.list',
    action() {
        mount(MainLayoutCtx, {
        content: () => (<ItemsList />)
      });
    }
  });
}

I get the following console output running the application on localhost:

Uncaught TypeError: Cannot read property 'route' of undefined
router.js:296There is no route for the path: /

Here is mye main.js fle and everything seems to be running fine here:

// client side main
import {createApp} from 'mantra-core';
import initContext from './configs/context';

//modules
import coreModule from './modules/core';
import usersModule from './modules/users';
import itemsModule from './modules/items';

// init context
const context = initContext();

// create app
console.log('main javascript here'); // this outputs to the console
const app = createApp(context);
app.loadModule(coreModule);
app.loadModule(usersModule);
app.loadModule(itemsModule);
app.init();

My Flowrouter is imported here and returned to the application:

import * as Collections from '/lib/collections';
import {Meteor} from 'meteor/meteor';
import {Flowrouter} from 'meteor/kadira:flow-router-ssr';
import {ReactiveDict} from 'meteor/reactive-dict';
import {Tracker} from 'meteor/tracker';

export default function(){
  return{
    Meteor,
    Flowrouter,
    Collections,
    LocalState: new ReactiveDict(),
    Tracker
  };
}

here is the link to my repo . any help is much appriciated


#2

Hello there!

You’ve been using Flowrouter instead of FlowRouter :stuck_out_tongue:


#3

Specifically, lines 3 and 10 in your config/context.js