geddy
Web framework for Node.js
Geddy | The original MVC Web framework for Node - a simple, structured way to create full stack javascript applications
i m posting a form in geddy. i need to update my meta data according to posted data by the form, for this i have to pass post to
<%= partial('layout_header', {post: post}); %>
<div class="mainContain">
<div class="container">
<div class="wrapper">
<% console.log(post.title); %>
<%- displayFlash(flash); %>
<%- render(); %>
</div>
</div>
</div>
for the above implementation i need my 'post' data on application.html.ejs.
thanks
Source: (StackOverflow)
Im evaluating the Geddy MVC framework for node.js
and I am seeing a strange issue - none of my breakpoints get hit when debugging.
I am using WebStorm to launch node.js
in debug mode.
I dont know how to make Geddy start in debug mode using the CLI command so I have a bootstrapper file that I use that looks like this:
console.log("Starting server...")
var geddy = require("geddy/bin/cli")
console.log("Server started.")
I set a breakpoint on all three lines and only the last console.log
gets hit, so at least I know that the breakpoints and debugging is working properly.
Geddy internally require()
's my controllers who also have breakpoints set in several locations. These never get hit, but the controllers do work properly and the HTTP requests are served properly as well.
Is there any reason why breakpoints will not be hit in Geddy? Is there something more I can do?
Source: (StackOverflow)
Is there a good documentation for Database Adapters for Geddy. I am trying to implement saving of the model data in geddy in an sqlite or similar database.
Source: (StackOverflow)
I'm using GeddyJS framework for a NodeJS application.
I got stuck with a problem in setting limit while making a call to all() method in any model.
I tried providing limit as one of the option but its not working as expected.
geddy.model.User.all({userId: 1}, {sort:{createdAt: "desc"},limit:10}, function(err,data){
Any Help???
PS: We are using MongoDB as database.
Source: (StackOverflow)
Not sure why this all of a sudden is broken, but when running Geddy, anytime I make a change, say in the controller, view, model. It isn't recognized and geddy does not restart.
Currently running ver:
Node: v0.10.20 via homebrew on Mac 10.8
Geddy: 0.10.3 via npm install -g geddy
Update:
Had to install geddy via: sudo npm install -g geddy
Seems to be restarting anytime files are saved now.
Source: (StackOverflow)
I'm planning on writing a web app using geddy and couchdb as a backend. I don't see a native support for couchdb in any of the geddys docs. Is there a npm module which will support couchdb as model objects?
I know there is a npm module nano but it seems like you have manually handle the connections.
Source: (StackOverflow)
i would like to use socket.io along with Geddy. I just followed the instructions in the below link:
https://github.com/mde/geddy/wiki/Getting-started-with-Geddy,-Socket.io,-and-Authentication
Suggest me how to catch the 'connection' event on specific model in server-side.
Also find below the glimpse of what i have did so far with this model...
geddy scaffold -rt LiveUpdate stat:string category:string
And found the following auto-generated scripts related to socket.io in "show.html.ejs" of
geddy.io.addListenersForModels(['LiveUpdate']);
geddy.model.LiveUpdate.on('update', function (chat) {
....
What i actually need is to know how to catch or emit events for this model from the server-side.
Source: (StackOverflow)
Using GeddyJS I have created a web app.
I have table with a datetime that I want to be relative ("5 minutes since..."). However the function in the GeddyJS docs isn't available when I use it in my page. it says
C:\Users\Chris\AppData\Roaming\npm\node_modules\geddy\lib\template\engines\ejs.js:74
throw err;
^
TypeError: ejs:28
26| <td><%= people[i].location %></td>
27| <td><%= people[i].recorder %></td>
>> 28| <td><%= geddy.relativeTime(new Date(people[i].time)) %></td>
29| <td><%= people[i].direction %></td>
30| <td><%= people[i].transportation %></td>
31| <td>(<%= people[i].id %>)</td>
Object #<Object> has no method 'relativeTime'
at Template.handleErr (C:\Users\Chris\AppData\Roaming\npm\node_modules\geddy\lib\template\engines\ejs.js:58:15)
at Object.Template.compile.rethrow (C:\Users\Chris\AppData\Roaming\npm\node_modules\geddy\lib\template\engines\ejs.js:90:41)
How should I make the call?
Source: (StackOverflow)
I'm running Geddy MVC Framework on Node.js on Heroku right now with a Postgres database. I can't seem to find any unit test frameworks for node.js that support Geddy. I have tried nodeunit, jasmine and a couple others but none seem to work with geddy (saying it is undefined - I think because it doesn't know how to import all of the required files).
I know Geddy provides their jake test tool but it doesn't seem to work either. It gives me this output:
ReferenceError: geddy is not defined
Any help would be greatly appreciated. Also looking for a code coverage tool that will work with the unit testing framework I get working.
Thanks!
EDIT: My tests all start with this header to import the required modules:
var assert = require('assert')
, tests
, Activity = geddy.model.Activity;
And the import of Activity fails with the ReferenceError above, so it never even tries my tests.
Here is a nodeunit test I wrote
var tests
, User = geddy.model.User;
exports['addUser1'] = function (test) {
var user = User.create({username: 'Greg',
password: 'MyPassword!',
confirmPassword: 'MyPassword!',
familyName: 'LastName1',
givenName: 'FirstName1',
email: 'Greg@greg.com'});
User.add(user, function (answerDict) {
test.equal(answerDict, {'errCode': 1});
test.done();
});
};
And the output
...../test/test-user.js:2
, User = geddy.model.User;
^
ReferenceError: geddy is not defined
.....
EDIT: Thought I'd post a direct link to the solution here. After some help on the github issue tracker, I was able to get testing and code coverage to work. I have a small write-up and link to example code too here: https://github.com/mde/geddy/wiki/Unit-Testing-&-Code-Coverage-With-Geddy
Source: (StackOverflow)
I'm using the geddy framework and following the validation examples.
In my User model I have the following custom validation rule:
this.validatesWithFunction('password', function(val) {
var re = /^[a-z0-9]+$/i;
return re.test(val)
}, {message: 'must be alphanumeric'})
In my view I do this:
<% if(params.err['password']) { %><%=params.err['password'];%><% } %>
The validation rule does work as expected. However, the message I get back appears to me a generic ("password" is invalid) message rather than the one I have specified in the options ("must be alphanumeric").
Any pointers as to where I am going wrong please?
Source: (StackOverflow)
I'm curious if anyone has any experience when running Geddy, if you can also run an additional resource, such as: https://github.com/AvianFlu/ntwitter
Would it be possible if you were to include the above via the package.json and reference it like:
var twitter = require('ntwitter');
var twit = new twitter({
consumer_key: 'Twitter',
consumer_secret: 'API',
access_token_key: 'keys',
access_token_secret: 'go here'
});
Then when you run geddy, it spawns another instance of itself, that would have access to models, etc, for saving tweets from the twitter streaming api? I know that I could just run it as a node server, then save the results to mongodb, but was hoping it's possible to start all of this and keep it within geddy.
Complete noob here when it comes to Geddy and Node.
Source: (StackOverflow)
I'm new with geddy and I'm getting confuse on how to use the model events.
My model has a slug field and I want to generate the slug (base on the name they entered) before I save any records.
In other words how do I do this in geddy?
rails model:
before_save :generateSlug
private:
def generateSlug
self.slug = self.name.parameterize
end
sample model code:
model/page.js
slugify = require('slug');
var Page = function(){
this.defineProperties({
slug: {type: 'string'},
name: {type: 'string', required: true}
});
this.beforeSave = function(){
this.slug = slugify(this.name);
}
}
exports.Page = Page;
When I run p = geddy.model.Page.create({name: 'hello world'});
and p.save(function(e,d){ console.log(d); })
slug is undefined
Source: (StackOverflow)
I'd like to use MongoDB with Geddy. I've edited my "production.js" file but it seems not working... I don't remember my MondoDB username and password...
I get this error : Error: 500 Internal Server Error
production.js :
var config = {
detailedErrors: false
, hostname: null
, port: 4000
, model: {
defaultAdapter: 'mongo'
}
, db: {
mongo: {
username: 'root'
, dbname: 'anthonycluse'
, prefix: null
, password: 'root'
, host: 'localhost'
, port: 27017
}
}
};
module.exports = config;
UPDATE
Command :
geddy gen secret
config.js :
var config = {
detailedErrors: true
, debug: true
, hostname: null
, port: 4000
, model: {
defaultAdapter: 'mongo'
}
, db: {
mongo: {
dbname: 'anthonycluse'
, host: 'localhost'
, port: 27017
}
}
Source: (StackOverflow)
There is an existing node.js application implemented using geddy framework, it is started by Heroku's foreman like so:
web: geddy
I am working on making it into a Heroku add-on. Heroku has a way to auto-generate the skeleton code necessary for an add-on, but it is implemented using express. It is started by this command:
web: node web.js
Internally, Heroku only allocates 1 port per app (that gets external traffic routed to it). Is there a way to start both existing geddy app and add-on express app on the same port? Or have some type of an application level router that would forward to geddy or express based on incoming request path?
Source: (StackOverflow)
how you unit test geddy controller? this is an example i want to test.
var assert = require('assert')
, tests
, controller = geddy.controller.create('Users');
tests = {
'test user controller, add new user': function (next) {
var user = User.create({username: 'hbinduni',
password: 'MyPassword!',
confirmPassword: 'MyPassword!',
familyName: 'binduni',
givenName: 'binduni',
email: 'hbinduni@email.com'});
//need to unit test controller.add here
//how to mock req, resp?
controller.add(req, resp, user);
assert.equal(out, null);
next();
}
};
module.exports = tests;
how can i do unit test on controller method? how to mock request and response?
thank you.
Source: (StackOverflow)