JonAbrams / synth

The first back-end framework specially designed for single-page web applications
http://www.synthjs.com
MIT License
969 stars 70 forks source link

Cannot create a new controller #76

Closed jrock2004 closed 10 years ago

jrock2004 commented 10 years ago

Just started learning this tool and for the life of me, I cannot get a new controller created. This is what I did to create a controller:

front-app.js

$routeProvider .when('/tweets', { templateUrl: '/html/tweets/getIndex.html', controller: 'tweetsController', resolve: { data: dataLoaderRunner } }) .when('/testcases', { templateUrl: '/html/testcases/getIndex.html', controller: 'testcasesController', resolve: { data: dataLoaderRunner } }) .otherwise({ redirectTo: '/tweets' });

jsFiles I added

controllers/testcases.js

js/controllers/testcases.js

angular.module('automation_dashboard') .controller('testcasesController', function ($scope, data) { $scope.tweets = data.tweets; });

Thoughts?

mikaelhm commented 10 years ago

if you look in the source of the html you get, do you see the controllers/testcases.js file being loaded?

jrock2004 commented 10 years ago

Well, when I load localhost:3000/testcases, I get an routes error page that has

Cannot GET /testcases

mikaelhm commented 10 years ago

oh, did you add the testcases resource in the back/resource folder?

i assume testcases is a new entity in your web app.

When you create an api-endpoint for it, synth will also add a front route for it.

jrock2004 commented 10 years ago

Do I create it manually or is there a synth command to do it?

mikaelhm commented 10 years ago

you create it manually :)

when you run synth s synth will generate end-points and routes for your web app (using express).

The end-points and routes generated is based on the file/folders present in your front and back folders within the synth project.

JonAbrams commented 10 years ago

Make a file at back/resources/testcases/index.js

In there declare a request handler:

exports.getIndex = function () {

  return {

    testcases: []

  };

};

On Fri, Sep 26, 2014 at 1:18 PM, Mikael Møller notifications@github.com wrote:

you create it manually :) when you run synth s synth will generate end-points and routes for your web app (using express). The end-points and routes generated is based on the file/folders present in your front and back folders within the synth project.


Reply to this email directly or view it on GitHub: https://github.com/JonAbrams/synth/issues/76#issuecomment-57014785