-
Notifications
You must be signed in to change notification settings - Fork 309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create good MVC base for app #17
Comments
I've decided to go with |
+1 Sounds good to me. Only comment I have, I usually go with Don't forget the |
I've got most of this working, just need to get the views fully functioning. I'll be using consolidate with hogan.js to process the templates--it is mustache, but really fast. We can always switch to some other processor later, but getting something working is the plan. I'll finish that up after I get home from work and open a pull request. |
Don't use Hogan.js, Mu is faster. It's really damn fast. I've been trying to find the fastest Mustache engine for about two weeks and even tried writing my own, but Mu has the best performance. Also don't waste time with consolidate. It is unnecessarily bloated for what it does (it has a hook for Mu but it's incredibly unoptimized), and we'll never use the other template engines it supports.
|
Here you go. It's the world's simplest wrapper to make Mu a view engine (see the comments for usage). I high-jacked the callback parameter on renderer to send the response stream, since that callback is just used to pass the template rendered as a string to the caller so they can send it as a response. That is inefficient, both in terms of speed and memory usage, and adds an extra step. Might as well just pipe to the response stream directly. |
I know I have the power to merge this pull request, but I'll leave it up to Cletus to make the decision since he's assigned to this issue and has been working on something of his own. Feel free to all/part/none of this patch. |
Woops, looks like this doesn't work--missing |
We were both working on a fix for my screw up at the same time. I put the file in a |
Btw I've never assigned or unassigned myself to this issue... not to mention I wasn't here back in late 2013. No mention of team biz label adding either from anyone. :\ Ahh GH glitches. :) UPDATE Appears my contact to GH support fixered some of it. :) FYI This is the generic, wip, structure that has been observed since entry (e.g. a visual aid for reference): We don't quite follow this completely yet but it is a goal none-the-less. Ref: |
We need a good MVC base for the app, with folder structure looking something like so:
Controllers: Handles all logic, db calls, etc and is used directly by our routes using something like
app.controllers.[category].[specific route]
(e.g.app.controllers.scripts.raw
to handle the.user.js
and.meta.js
routines).Models: Complete schema data and db-specific logic here, which would most likely use mongoose to make it easier.
Views: All templates. Hook into using express's
view engine
andviews
so that we can easily callres.render([viewname], [data])
.Public: All the frontend publicly visible stuff.
Opinion needed
What extension should we use for templates (which will be Mustache)? Some sites I've seen use
[file].mustache
and others[file].tpl
. I'd prefer.tpl
in case we ever switched template engines down the line.The text was updated successfully, but these errors were encountered: