Giter Club home page Giter Club logo

matador's Introduction

Matador

DEPRECATION WARNING: Matador has been deprecated and is no longer actively maintained. We do not recommend continuing to use Matador.

Build Status

Sane defaults and a simple structure, scaling as your application grows.

Matador is a clean, organized framework for Node.js architected to suit MVC enthusiasts. It gives you a well-defined development environment with flexible routing, easy controller mappings, and basic request filtering. It’s built on open source libraries such as SoyNode for view rendering, and connect.js to give a bundle of other Node server related helpers.

Installation

Get the CLI

$ npm install matador -g

Create an app

$ matador init my-app
$ cd my-app && npm install matador

Start your app

$ node server.js

Dancing with the Bulls

Build on your app

// app/config/routes.js
'/hello/:name': { 'get': 'Home.hello' }

// app/controllers/HomeController.js
hello: function (request, response, name) {
  response.send('hello ' + name)
}

View Rendering

Uses SoyNode to render Closure Templates.

// app/controllers/HomeController.js
this.render(response, 'index', {
  title: 'Hello Bull Fighters'
})
<!-- app/views/layout.soy -->

{namespace views.layout}

/**
 * Renders the index page.
 * @param title Title of the page.
 */
{template .layout autoescape="contextual"}
  <!DOCTYPE html>
  <html>
    <head>
      <meta http-equiv='Content-type' content='text/html; charset=utf-8'>
      <title>{$title}</title>
      <link rel='stylesheet' href='/css/main.css' type='text/css'>
    </head>
    <body>
      {$ij.bodyHtml |noAutoescape}
    </body>
  </html>
{/template}

{namespace views.index}

/**
 * Renders a welcome message.
 * @param title Title of the page
 */
{template .welcome}
  <h1>Welcome to {$title}</h1>
  (rendered with Closure Templates)
{/template}

Routing

The app/config/routes.js file is where you specify an array of tuples indicating where incoming requests will map to a controller and the appropriate method. If no action is specified, it defaults to 'index' as illustrated below:

module.exports = function (app) {
  return {
    '/': 'Home' // maps to ./HomeController.js => index
  , '/admin': 'Admin.show' // maps to ./admin/AdminController.js => show
  }
}

You can also specify method names to routes:

module.exports = function (app) {
  return {
    '/posts': {
      'get': 'Posts.index', // maps to PostsController.js => #index
      'post': 'Posts.create' // maps to PostsController.js => #create
    }
  }
}

How can I organize my Models?

By default, Models are thin with just a Base and Application Model in place. You can give them some meat, for example, and embed Mongo Schemas. See the following as a brief illustration:

// app/models/ApplicationModel.js
module.exports = function (app, config) {
  var BaseModel = app.getModel('Base', true)

  function ApplicationModel() {
    BaseModel.call(this)
    this.mongo = require('mongodb')
    this.mongoose = require('mongoose')
    this.Schema = this.mongoose.Schema
    this.mongoose.connect('mongodb://localhost/myapp')
  }
  util.inherits(ApplicationModel, BaseModel)
  return ApplicationModel
}

Then create, for example, a UserModel.js that extended it...

module.exports = function (app, config) {
  var ApplicationModel = app.getModel('Application', true)

  function UserModel() {
    ApplicationModel.call(this)
    this.DBModel = this.mongoose.model('User', new this.Schema({
        name: { type: String, required: true, trim: true }
      , email: { type: String, required: true, lowercase: true, trim: true }
    }))
  }
  util.inherits(UserModel, ApplicationModel)
  return DBModel

  UserModel.prototype.create = function (name, email, callback) {
    var user = new this.DBModel({
        name: name
      , email: email
    })
    user.save(callback)
  }

  UserModel.prototype.find = function (id, callback) {
    this.DBModel.findById(id, callback)
  }

}

This provides a proper abstraction between controller logic and how your models interact with a database then return data back to controllers.

Take special note that models do not have access to requests or responses, as they rightfully shouldn't.

Model & Controller Inheritance

Matador uses the default node inheritance patterns via util.inherits.

Scaffolding

$ matador controller [name]
$ matador model [name]

Contributing & Development

Questions, pull requests, bug reports are all welcome. Submit them here on Github. When submitting pull requests, please run through the linter to conform to the framework style

$ npm install -d
$ npm run-script lint

Authors

Obviously, Dustin Senos & Dustin Diaz

License

Copyright 2012 Obvious Corporation

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

matador's People

Contributors

azulus avatar davidbyttow avatar ded avatar dnf avatar dustinsenos avatar eduardolundgren avatar evansolomon avatar fabianonunes avatar jfhbrook avatar ktzhu avatar kylehg avatar kylewm avatar lxcodes avatar majelbstoat avatar nicks avatar ox avatar rouxbot avatar valueof avatar vinibaggio avatar zcsteele avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

matador's Issues

https setup

my versions

  • Node : v0.8.8
  • matador : v1.1.19-beta

How to set up HTTPS?

How I get access to model?

Hi,

I build a model like the example "How can I organize my Models?" in the Readme.md, but how can I access the model in controller? If I call this.getModel(...) I get the error message "TypeError: Object # has no method 'getModel'".

Matador init Error

Hi,

I have matador installed and I just tried to do a..

matador init myApp

Got the success, then went to start server..

cd myApp/

node server.js

Then got this

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'hogan.js'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object. (/Users/wes/Sites/myApp/node_modules/matador/src/matador.js:2:13)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17

Looks like hogan is missing? Is this something that doesn't come with matador by default?

Thanks

Vhost use

Hello,

I was used to set my vhost on express. It allowed me to redirect request form hosts I selected to another express instance. Since Matador is built on top of express, how can I use it ? To use vhoston express, we had to do, in the config part, app.use(express.vhost('domain.com', require('file/to/app.js')));

Nested partials seem to cause error

Hi,

I found that it isn't possible to nest partials without getting an error. Is nesting partials something that most people don't do, or is this a bug that could be fixed?
Thank you

DEBUG: Error: Closing tag without opener: /stuff
at buildTree (/Users/lash/code/nodeThings/recipe/node_modules/matador/node_modules/hogan.js/lib/compiler.js:199:17)
at Object.parse (/Users/lash/code/nodeThings/recipe/node_modules/matador/node_modules/hogan.js/lib/compiler.js:318:12)
at Object.compile (/Users/lash/code/nodeThings/recipe/node_modules/matador/node_modules/hogan.js/lib/compiler.js:345:38)
at Object.<anonymous> (/Users/lash/code/nodeThings/recipe/node_modules/matador/src/matador.js:23:37)
at ServerResponse._render (/Users/lash/code/nodeThings/recipe/node_modules/matador/node_modules/express/lib/view.js:425:21)
at ServerResponse.render (/Users/lash/code/nodeThings/recipe/node_modules/matador/node_modules/express/lib/view.js:318:17)
at fn.render (/Users/lash/code/nodeThings/recipe/node_modules/matador/src/BaseController.js:30:21)
at fn.index (/Users/lash/code/nodeThings/recipe/app/controllers/RecipeController.js:6:12)
at /Users/lash/code/nodeThings/recipe/node_modules/matador/src/router.js:26:20
at f (/Users/lash/code/nodeThings/recipe/node_modules/matador/node_modules/valentine/valentine.js:469:20)

Session doesn't persist through res.redirect

I'm having an issue with req.session... The session doesn't seem to carry over after a res.redirect in my case?

I've been displaying messages using req.session.messages, the following is req.session before and after the redirect:

Before:

{ lastAccess: 1334797835151,
  cookie:
   { path: '/',
     httpOnly: true,
     _expires: Thu, 19 Apr 2012 05:10:35 GMT,
     originalMaxAge: 14400000 },
  messages: { success: 'Review by Name has been added!' } }

After:

{ lastAccess: 1334797835212,
  cookie:
   { path: '/',
     httpOnly: true,
     _expires: Thu, 19 Apr 2012 05:10:35 GMT,
     originalMaxAge: 14400000 } }

Any idea what's going on here? Thanks for your help!

Admin Section by Generator

Perhaps this is temporary, but at the moment creating a new application creates an administration section. I would prefer to have this moved into a separate generator or plugin or something. Was wondering what you guys thought of that.

Great work, please let me know if I can help. I am loving matador (using it on 2 projects already). :-)

Changes in partials not being refreshed

I'm not sure if this is a matador issue - but if I change a partial template, those changes are not reflected on a running development server. I need to restart the server. It seems to be isolated to the partials, not the actual template files.

Any idea why?

CLI doesn't work in Windows

This is due to using require('child_process').exec — which should be avoided in favor of using Node's built-in fs API.

Controller viewFolder setting has no effect

In the readme this functionality is documented:

return app.getController('Application', true).extend(function () {
  this.viewFolder = "admin" // we've set the view folder to "admin".
})

However this has no effect for me and partials are still being loaded from the views/partials dir

unit testing a model

I'm trying to use jasmine and test a model created with matador - only I run into a problem, in that every time I run a test I have to load the entire sever app because of chained together dependencies.

Is there a way around that? With that in the way, It makes it difficult to use continuous integration testing when building an app with matador...

I'm also a bit of a node noob - (come from a .net and rails background) - so there might be some easy way to do this... Do you all have a sample app with specs?

Any pointers would be a big help!

Error loading file

I've tried to install matador as instructed, but when I cd into my-app/all and run node server.js I get a load of errors

jason@jason:~/jason/my-app/all$ node server.js
Error loading file: models ApplicationModel /home/jason/jason/my-app/all/app ReferenceError: loadClass is not defined
at Function.app.getModel (/home/jason/jason/my-app/node_modules/matador/src/matador.js:365:12)
at module.exports (/home/jason/jason/my-app/all/app/models/ApplicationModel.js:2:14)
at FileLoader. (/home/jason/jason/my-app/node_modules/matador/src/FileLoader.js:64:56)
at /home/jason/jason/my-app/node_modules/matador/node_modules/valentine/valentine.js:167:22
at Array.some (native)
at Object.iters.some.i as some
at Function.iters.find (/home/jason/jason/my-app/node_modules/matador/node_modules/valentine/valentine.js:166:13)
at FileLoader.loadFile (/home/jason/jason/my-app/node_modules/matador/src/FileLoader.js:60:15)
at /home/jason/jason/my-app/node_modules/matador/src/matador.js:319:22
at Array.forEach (native)

ReferenceError: loadClass is not defined
at Function.app.getModel (/home/jason/jason/my-app/node_modules/matador/src/matador.js:365:12)
at module.exports (/home/jason/jason/my-app/all/app/models/ApplicationModel.js:2:14)
at FileLoader. (/home/jason/jason/my-app/node_modules/matador/src/FileLoader.js:64:56)
at /home/jason/jason/my-app/node_modules/matador/node_modules/valentine/valentine.js:167:22
at Array.some (native)
at Object.iters.some.i as some
at Function.iters.find (/home/jason/jason/my-app/node_modules/matador/node_modules/valentine/valentine.js:166:13)
at FileLoader.loadFile (/home/jason/jason/my-app/node_modules/matador/src/FileLoader.js:60:15)
at /home/jason/jason/my-app/node_modules/matador/src/matador.js:319:22
at Array.forEach (native)

Any ideas what is going wrong?

app.dynamicHelpers()

Using other Express view engines (e.g. Jade) I am able to use [app.dynamicHelpers](http://expressjs.com/guide.html#app.dynamichelpers(\)) to make certain variables available to templates. For example:

app.dynamicHelpers({
  foo: function(req, res) { return "Foo"; }
})

is accessible in my templates as:

Hello, {{foo}}!

However, it appears that the matador.engine is not passing the dynamic helpers through to res.render.

I suspect that it's this line in matador.js, but I'm not confident enough with the source to know for sure, or to suggest a pull request:

return hogan.compile(source, options).render(options.locals, options.partials)

Inspecting options I see foo, however it is a child of options itself, and not options.locals.

Testing

Currently matador projects are a pain to test because of their dependencies on globals like Class. So either we need to roll some sort of test framework integration that will do this bootstrapping for you, or ditch the globals. Any other options? I want to discuss this.

How do you parse the body of a POST request?

the request parameter in controller methods doesn't have a body attribute like in express. How do I parse the data sent from a POST ajax request in a controller?

In matador.js there is no use of connect's bodyParser, where is the logic for parsing POST requests?

It's probably @obvious, but I'm stuck and I need a little direction.

autogenerated app error

nodejs 0.6.19
after installation i did simple test
$ matador init tt1
$ cd !$ && npm install matador
$ cd all && node server.js

got bunch of errors

matador running on port 3000
soynode: Compile error
execvp(): No such file or directory

/srv/www/tt1/node_modules/matador/src/matador.js:431
throw err
^
Error: Error compiling templates
at ChildProcess. (/srv/www/tt1/node_modules/matador/node_modules/soynode/lib/soynode.js:177:18)
at ChildProcess.emit (events.js:70:17)
at maybeExit (child_process.js:362:16)
at Socket. (child_process.js:467:7)
at Socket.emit (events.js:67:17)
at Array.0 (net.js:335:10)
at EventEmitter._tickCallback (node.js:190:38)

{ locals: {}} on the site

just wanted to point out that res.render()'s locals object is legacy. It's still 100% fine but it will look a little bit cuter with:

render('index', { title: 'whatever' })

:D

autoescape issue on alpha 6

Hey,

I'm just getting started with matador, and just following the instructions. I'm getting an issue on a clean install of matador:

soynode: Compile error
Exception in thread "main" com.google.template.soy.base.SoySyntaxException: In file layout.soy: Invalid value for attribute 'autoescape' in 'template' command text (autoescape="contextual").
at com.google.template.soy.base.SoySyntaxException.createWithoutMetaInfo(SoySyntaxException.java:51)
at com.google.template.soy.soytree.CommandTextAttributesParser.parse(CommandTextAttributesParser.java:135)
at com.google.template.soy.soytree.TemplateBasicNodeBuilder.setCmdText(TemplateBasicNodeBuilder.java:103)
at com.google.template.soy.soytree.TemplateBasicNodeBuilder.setCmdText(TemplateBasicNodeBuilder.java:46)
at com.google.template.soy.soyparse.SoyFileParser.Template(SoyFileParser.java:299)
at com.google.template.soy.soyparse.SoyFileParser.SoyFile(SoyFileParser.java:276)
at com.google.template.soy.soyparse.SoyFileParser.parseSoyFile(SoyFileParser.java:191)
at com.google.template.soy.soyparse.SoyFileSetParser.parseSoyFileHelper(SoyFileSetParser.java:266)
at com.google.template.soy.soyparse.SoyFileSetParser.parseWithVersions(SoyFileSetParser.java:213)
at com.google.template.soy.soyparse.SoyFileSetParser.parse(SoyFileSetParser.java:173)
at com.google.template.soy.SoyFileSet.compileToJsSrcFiles(SoyFileSet.java:932)
at com.google.template.soy.SoyToJsSrcCompiler.execMain(SoyToJsSrcCompiler.java:302)
at com.google.template.soy.SoyToJsSrcCompiler.main(SoyToJsSrcCompiler.java:242)

soynode: [Error: Error compiling templates]

OS: OSX Yosimite
Node Version: 0.10.32

Steps taken:

npm install matador -g
matador init test
cd test
node server.js

Something I'm doing wrong?

Using mysql with matador

Hello,

I've just discovered your framework and think about using it to replace express for me. But I usually use mysql. Do you know a way to use it with matador easily ?

v0.0.11 seems to throw a filter error while routing

This works ok in 0.0.10, tho. It's a simple app, something as shown in your examples. Here's the error stack.

TypeError: Cannot call method 'filter' of undefined
at /srv/myapp/node_modules/matador/node_modules/valentine/valentine.js:70:18
at Valentine.filter (/srv/myapp/node_modules/matador/node_modules/valentine/valentine.js:513:20)
at /srv/myapp/node_modules/matador/src/router.js:10:12
at callbacks (/srv/myapp/node_modules/matador/node_modules/express/lib/router/index.js:272:11)
at param (/srv/myapp/node_modules/matador/node_modules/express/lib/router/index.js:246:11)
at pass (/srv/myapp/node_modules/matador/node_modules/express/lib/router/index.js:253:5)
at Router._dispatch (/srv/myapp/node_modules/matador/node_modules/express/lib/router/index.js:280:4)
at Object.handle (/srv/myapp/node_modules/matador/node_modules/express/lib/router/index.js:45:10)
at next (/srv/myapp/node_modules/matador/node_modules/express/node_modules/connect/lib/http.js:203:15)
at next (/srv/myapp/node_modules/matador/node_modules/express/node_modules/connect/lib/http.js:205:9)

node.js v0.8.6 error in BaseController

error log : path.existsSync is now called fs.existsSync

At BaseController findFile method

if (path.existsSync(filePath)) {
  return filePath
}

change to

var fs = require('fs')
, path = require('path')
, soynode = require('soynode')
, existsSync = fs.existsSync || path.existsSync

//snip

if (existsSync(filePath)) {
  return filePath
}

Confusion on Route Format...

The readme shows:

['get', '/hello/:name', 'Home', 'hello']

but creating a new app shows:

module.exports = {
  root: [
    ['get', '/', 'Home']
  ]
}

I'm just trying to create a structure similar to rails - the controllers are all at the root of my controllers directory, and then under the views directory, there's a subdirectory for each controller.

How should the routes file look with a root controller as generated, and then a UsersController that maps to the above directory structure?

-Thanks!

The next callback function is not available in controllers

I like the way matador is providing a simpler method to req.params for controllers, but leaving off the next callback is problematic. Specifically I've had problems when integrating with Passport for authentication which expects the next to be there for passing on errors.

.svn and Matador

Hello,
I have a problem with matador. I use SVN and it drops automatically .svn folders in every folders. The problem is that I get this error:

    at /home/nicolas/public_html/app/svn/trunk/app/host/chat_server/all/node_modules/matador/src/matador.js:70:25
    at /home/nicolas/public_html/app/svn/trunk/app/host/chat_server/all/node_modules/matador/src/matador.js:126:11
    at Array.forEach (native)
    at Object.each (/home/nicolas/public_html/app/svn/trunk/app/host/chat_server/all/node_modules/matador/node_modules/valentine/valentine.js:26:20)
    at Function.each (/home/nicolas/public_html/app/svn/trunk/app/host/chat_server/all/node_modules/matador/node_modules/valentine/valentine.js:319:15)
    at /home/nicolas/public_html/app/svn/trunk/app/host/chat_server/all/node_modules/matador/src/matador.js:124:11
    at Array.forEach (native)
    at Object.each (/home/nicolas/public_html/app/svn/trunk/app/host/chat_server/all/node_modules/matador/node_modules/valentine/valentine.js:26:20)
    at Function.each (/home/nicolas/public_html/app/svn/trunk/app/host/chat_server/all/node_modules/matador/node_modules/valentine/valentine.js:319:15)
    at /home/nicolas/public_html/app/svn/trunk/app/host/chat_server/all/node_modules/matador/src/matador.js:121:9

Do you have an idea ?

First run of server.js: unhandled errors

Using node version 0.10.7

Hi there, I'm having some trouble getting my first app set up. I followed the instructions up to the point of running "node server.js" and everything went smoothly - success messages and all. When I tried to run server.js however, I ran into a couple problems.

After installing matador in the app directory, I have the following basic folder structure:
create-announcement
----all
--------app
-------------(various subfolders)
--------server.js
----node_modules

The directions seem to imply using the "node server.js" command within the app root directory. That didn't work for me, which made sense to me since the server.js is in the "all" folder.

So I cd into the all folder and run the command there. It starts to work and says "matador running on port 3000" but then I get an unhandled error that seems to block it. See attached image for error specifics.

matadorerror

Am I just doing something wrong or is this an actual bug or some weird system thing? I'm new to node and matador so I'm definitely not confident in my debugging abilities.

Thanks in advance for any advice!

Running on Windows

I've followed the following steps and am getting the error below:

  1. Made a directory for my new app
  2. Opened a command prompt in the directory
  3. npm install matador (worked as expected)
  4. matador init myApp (error as below)

Error:
installing Matador into myApp
error { [Error: Command failed: 'cp' is not recognized as an internal or externa
l command,
operable program or batch file.
] killed: false, code: 1, signal: null }

Any help would be greatly appreciated.

Kind Regards

Shaun

Example code?

First wanted to say that I am loving matador. My only issue is that some of the readme seems to be out of date with the current code. I've been picking through the code as needed but it would be helpful to see a more flushed out example of a basic app. Does anyone know of an example app I can poke through?

Again thx for the cool framework and all the work you guys have obvi put into it.

404 layout

Is there a way to link the 404.html page to the layout, because it's painful to have to change that page every time we change the layout :/

Documentation issues

I'm playing around with Matador and there are a few places where the documentation on the github project page doesn't match the current implementation (or, I'm doing it wrong).

e.g. Adding a before filter:

module.exports = function (app, config) {   
  return app.controllers.Base.extend(function() {
    this.addBeforeFilter(this.requireAuth);
  }).methods({
    requireAuth: function(callback) {
      return callback(null);
    }
  });
}

Gives me the following error:

TypeError: object is not a function
    at IncomingMessage.CALL_NON_FUNCTION (native)
    at /Users/taylorr/Code/myapp/app/controllers/ApplicationController.js:7:14
    at callbacks (/Users/taylorr/Code/myapp/node_modules/matador/node_modules/express/lib/router/index.js:272:11)
    at param (/Users/taylorr/Code/myapp/node_modules/matador/node_modules/express/lib/router/index.js:246:11)
    at pass (/Users/taylorr/Code/myapp/node_modules/matador/node_modules/express/lib/router/index.js:253:5)
    at Router._dispatch (/Users/taylorr/Code/myapp/node_modules/matador/node_modules/express/lib/router/index.js:280:4)
    at Object.handle (/Users/taylorr/Code/myapp/node_modules/matador/node_modules/express/lib/router/index.js:45:10)
    at next (/Users/taylorr/Code/myapp/node_modules/matador/node_modules/express/node_modules/connect/lib/http.js:204:15)
    at next (/Users/taylorr/Code/myapp/node_modules/matador/node_modules/express/node_modules/connect/lib/http.js:206:9)
    at Object.methodOverride [as handle] (/Users/taylorr/Code/myapp/node_modules/matador/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js:35:5)

Can you help me out here?

i18n question

Great framework, need some documentation of how to get i18n working

Version "0.0.13" not working.

Initialize a new application with matador using the latest version; get a node error trying to run the code:

TypeError: Cannot read property 'layout' of undefined

Use Jake to add tasks to Matador

I'd love to see a few CLI tasks for matador, loosely based on the rails rake tasks:

  • jake routes: List routes if you're in a matador project directory
  • jake generate: Generate new routes, controllers, and models for a resource
  • jake server: starts up the server
  • jake console: starts up a repl with a running matador app in it, so you can play around with your models

Any other ideas?

If you guys think this is a good idea, I'll start in on it.

BeforeFilter Error

If a beforeFilter returns an error, matador tries to fire an error method on the controller. The framework doesn't declare any error methods on either ApplicationController or BaseController.

Parameter and wildcard matches are decodeURIed twice

Tracking down a bug in medium2, I noticed matador is unescaping parameters one too many times. For example, if

  1. there's a route /dir/*
  2. client wants to send the parameter http://hi%5Ethere
  3. client hits the path /dir/http%3A%2F%2Fhi%255Ethere
  4. matador tells me * is http://hi^there (^ should be %5E)

I added a test demonstrating: https://github.com/Medium/matador/compare/kylewm/over-decoding with the result:

✖ testNamedParameterEscaping

AssertionError: 'hello%20world' == 'hello world'
    at Object.equal (/Users/kylemahan/src/matador/node_modules/nodeunit/lib/types.js:83:39)
    at /Users/kylemahan/src/matador/tests/functional/routing_test.js:17:10
    ...

✖ testWildcardEscaping

AssertionError: 'http://example.com/abc%5E123' == 'http://example.com/abc^123'
    at Object.equal (/Users/kylemahan/src/matador/node_modules/nodeunit/lib/types.js:83:39)
    at /Users/kylemahan/src/matador/tests/functional/routing_test.js:31:10
    ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.