[nodejs] Re: Can node.js handle a large swarm of buffers sending stimulously and continuously
you still can have several processes. just use child_process.fork api. but it would be better to upgrade Am Donnerstag, 16. Mai 2013 02:36:14 UTC+2 schrieb Ket: OK. I find this thread : http://stackoverflow.com/questions/11620648/whats-the-difference-between-node-js-cluster-module-and-learnboosts-cluster-m That's too bad. I'm using v 0.6.18 on the web server. Thanks -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[nodejs] Re: Can node.js handle a large swarm of buffers sending stimulously and continuously
and may be you should just try with a single instance first and measure Am Donnerstag, 16. Mai 2013 02:36:14 UTC+2 schrieb Ket: OK. I find this thread : http://stackoverflow.com/questions/11620648/whats-the-difference-between-node-js-cluster-module-and-learnboosts-cluster-m That's too bad. I'm using v 0.6.18 on the web server. Thanks -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[nodejs] Migrate the CSV parser to the new Stream API
I'm david, maintainer of the CSV module (https://github.com/wdavidw/node-csv-parser). I'm thinking to migrate the CSV parser from the old style api to the new one. It also seems like a good idea to ask around what would be the best practice in such case. An issue is created on GitHub: https://github.com/wdavidw/node-csv-parser/issues/107. I introduce this issue with: It is time to migrate the CSV parser into the new [Stream API](http://www.nodejs.org/api/stream.html). This issue is created to all user of the parser. Please comment it with your own API suggestions, feature list and implementation details. Write down all your wish list. If API should evolve/break, this is the good time to do it. I have a few questions relative to the implementation that I wish to ask here. 1. Which API seems the best to the users. I'm thinking about 3 main classes: - a Parser class which take strings/buffers and output an arrays/objects of fields - a Stringifier class which take arrays/objects and output arrays/objects of fields - a Transform class which is both a Parser and a Stringifier and is used to transform a CSV stream into another CSV stream Any suggestion is welcome 2. Considering the API described above, my understanding is that both the Parser and Stringifier should be duplex or transform instances. However, the API should differ slightly in the sense that the read function of the Parser class should return an array or an object and the write function of the Stringifier class should accept an array or an object. Is this correct and acceptable ? 3. Is someone familiar with the new Stream api willing to behave as a mentor to follow me and make sure I got this right during the development phase? Thanks in advance for the community feedback, d. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[nodejs] Sending Custom Headers from Client to Server
Hi All, I am trying sending some Custom Headers from Client to Server. The following ajax call is capable to send header information to server. *Client AJAX Call:* $.ajax({ type: GET, url: ws_url, dataType: jsonp, headers:{ custom_header:head_val }, success: function(data) { alert(data) } }); With above ajax call, I can get the header information at server end using JAVA based Apache CXF Web Services like below: String client_custom_header = HttpHeaders.getRequestHeaders().getFirst(custome_header); //I am getting the header value head_val. If I am trying to implement same thing in node.js with express frame work; I cannot read the headers info. * Please find my node.js code:* var https = require('http'); var express = require('express') var app = express.createServer(); var allowCrossDomain = function(req, res, next) { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With'); }; app.configure(function () { app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(app.router); // app.use(allowCrossDomain); app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); }); app.get('/getData', function(request, response){ console.log('STATUS: ' + response.getHeader('custom_header'));//undefined console.log('HEADERS: ' + JSON.stringify(response.headers));//undefined console.log(emp_value:+request.headers['custom_header']); //undefined console.log(\n\n*111***+request.body); //undefined console.log('params: ' + JSON.stringify(request.params));//[] console.log('header: ' + JSON.stringify(request.header(Access-Control-Allow-Origin, *)));//* console.log('body: ' + JSON.stringify(request.body));//undefined console.log('query: ' + JSON.stringify(request.query));//{d:20} console.log('query: ' + request.query.d);//20 }); app.listen(8889); - I tried several options but I couldn't. Please help me soon. Thanks in advance.. Ramesh -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[nodejs] using .read() on a crypto hash
Hi, I'm trying to use write and read instead of update and digest as per the doc's recommendations but I can't make it work: function createHmac (b64secret, message) { var hmac = crypto.createHmac('sha512', b64secret); hmac.write(message); return hmac.read(); } console.log(createMtGoxHmac(b64secret, new Buffer('Test\0Message'))); this returns null where am I doing it wrong? -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[nodejs] Re: using .read() on a crypto hash
apparently I need to call hmac.end() before reading On Thursday, May 16, 2013 1:29:18 PM UTC+2, Stanislas Marion wrote: Hi, I'm trying to use write and read instead of update and digest as per the doc's recommendations but I can't make it work: function createHmac (b64secret, message) { var hmac = crypto.createHmac('sha512', b64secret); hmac.write(message); return hmac.read(); } console.log(createMtGoxHmac(b64secret, new Buffer('Test\0Message'))); this returns null where am I doing it wrong? -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[nodejs] Re: https, GoDaddy SSL cert, node.js under Microsoft Azure
I ran through same issue and hit here. I generated pfx from the godaddy certificate files using IIS admin console. Provided pfx and passphrase options to https.createServer(options). Refer herehttp://youmayneedthis.wordpress.com/2013/05/16/getting-pfx-file-for-nodejs-https-server-from-godaddy-ssl-certificate/for details. HTH someone. On Thursday, August 2, 2012 8:57:36 PM UTC+5:30, thstart wrote: Install GoDaddy SSL certificate with Node.js I want to use https for my web app which is running on Microsoft Azure. I used IIS to generate certificate for GoDaddy then downloaded two files: domain name.crt gd_iis_intermediates.p7b Then I followed procedures described in GoDaddy to export and password protect my domain name.pfx certificate. Uploaded to MS Azure now my site is serving https only. Now I need to use https.createServer(options, [requestListener]) as described in: http://nodejs.org/api/https.html // curl -k https://localhost:8000/var https = require('https');var fs = require('fs'); var options = { key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')}; https.createServer(options, function (req, res) { res.writeHead(200); res.end(hello world\n);}).listen(8000); There is not a key when I am using IIS so I have to extract it from the .pfx and remove the password or to use the .pfx directly (which needs a password). How is the right way to handle this? var https = require('https');var fs = require('fs'); var options = { pfx: fs.readFileSync('server.pfx')}; https.createServer(options, function (req, res) { res.writeHead(200); res.end(hello world\n);}).listen(8000); -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[nodejs] Re: Sending Custom Headers from Client to Server
i trieyd out, it works for me: console.log(emp_value:+request.headers['custom_header']); *//** emp_value:head_val* Am Donnerstag, 16. Mai 2013 12:33:19 UTC+2 schrieb Rams B: Hi All, I am trying sending some Custom Headers from Client to Server. The following ajax call is capable to send header information to server. *Client AJAX Call:* $.ajax({ type: GET, url: ws_url, dataType: jsonp, headers:{ custom_header:head_val }, success: function(data) { alert(data) } }); With above ajax call, I can get the header information at server end using JAVA based Apache CXF Web Services like below: String client_custom_header = HttpHeaders.getRequestHeaders().getFirst(custome_header); //I am getting the header value head_val. If I am trying to implement same thing in node.js with express frame work; I cannot read the headers info. * Please find my node.js code:* var https = require('http'); var express = require('express') var app = express.createServer(); var allowCrossDomain = function(req, res, next) { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With'); }; app.configure(function () { app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(app.router); // app.use(allowCrossDomain); app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); }); app.get('/getData', function(request, response){ console.log('STATUS: ' + response.getHeader('custom_header'));//undefined console.log('HEADERS: ' + JSON.stringify(response.headers));//undefined console.log(emp_value:+request.headers['custom_header']); //undefined console.log(\n\n*111***+request.body); //undefined console.log('params: ' + JSON.stringify(request.params));//[] console.log('header: ' + JSON.stringify(request.header(Access-Control-Allow-Origin, *)));//* console.log('body: ' + JSON.stringify(request.body));//undefined console.log('query: ' + JSON.stringify(request.query));//{d:20} console.log('query: ' + request.query.d);//20 }); app.listen(8889); - I tried several options but I couldn't. Please help me soon. Thanks in advance.. Ramesh -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [nodejs] Re: HTTPS request incomplete when piping to a file
FWIW that did not fix the problem. On Wed, May 15, 2013 at 11:17 AM, Matt hel...@gmail.com wrote: On Wed, May 15, 2013 at 4:25 AM, greelgorke greelgo...@gmail.com wrote: are you sure it's the end of the file? not the start? Yeah - the files always start with the correct %PDF bytes. It's just missing the index at the end of the file. I'll try your suggestion anyway, and see if it makes any difference. Matt. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[nodejs] insert data node.js to mongodb
i have to create master detail form like that var purchase_order = { _id: 1 title: ‘Purchase order 1’, total: 10.50, line_items: [ { sku: ‘a’, quantity: 1, price: 10.50 } ] } how to insert data from front end(juqery easy ui) and node.js in mongodb without using relational schema. Please help me it is really very difficult job for me ... -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[nodejs] Re: Sending Custom Headers from Client to Server
On May 16, 6:33 am, Rams B bramesh.mc...@gmail.com wrote: console.log('HEADERS: ' + JSON.stringify(response.headers));//undefined You probably want `request.headers` not `response.headers` here. Perhaps with this change, this particular output may be helpful in seeing what's wrong. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[nodejs] Question about tokens map
Is it possible to get tokens map into javascript code, maybe something like token_get_all method in php? Thanks -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[nodejs] Re: Having trouble replicating with npm repo (couchdb) - anyone tried it lately and/or seen this error?
Hi Andy, I'm also seeing the exact same issue trying to replicate isaacs.iriscouch.com to another iriscouch.com database, it gets stuck at 17,286 documents (16gb) and those errors start to appear in the log. Have you found any more details about this issue? Sincerely, Kevin On Monday, May 13, 2013 8:16:51 PM UTC-7, andy wrote: Based on the awesome feedback I got from https://groups.google.com/d/msg/nodejs/sX4mbsRPwls/WtDDE-To2o4J, we tried replicating the npm repo so we could use it in an offline environment. We're essentially following the instructions at http://clock.co.uk/tech-blogs/how-to-create-a-private-npmjs-repositorybut replication fails after syncing about 17k documents. We've tried reinstalling couch (found one issue that suggested using a patched version of SpiderMonkey) but the same thing keeps happening, even after restarting replication several times. Here's our setup: CentOS 6.4 CouchDB 1.3 SpiderMonkey 1.8.5-7 Replication works fine for over 17,000 documents, then we see this error and can't get past it: [Sat, 11 May 2013 00:55:39 GMT] [error] [0.12970.4] Replicator: couldn't write document `bufferhelper`, revision `19-d339684ee7f5eaf4cc18d84da753832d`, to target database `registry`. Error: `unauthorized`, reason: `Please log in before writing to the db`. Any ideas? Thanks, Andy -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [nodejs] Re: Having trouble replicating with npm repo (couchdb) - anyone tried it lately and/or seen this error?
Kevin, Unfortunately, no. We tried a few of the tips mentioned here on the CouchDB list ( http://mail-archives.apache.org/mod_mbox/couchdb-user/201305.mbox/%3cCAL+Y1nuP=wBwXn8eM7MBzZg2v3nKChTEVmo=bntwhf5ukfi...@mail.gmail.com%3e) - for example, we didn't have an admin user set up, so we tried that and it looked like it would work...but we restarted replication with a new DB (we want this to be a repeatable process) and it failed after only 500 or so documents. We were still trying Couch 1.3 so we're gonna drop down to 1.2.1 and see how that goes. So, no real idea what is wrong. If anyone has more tips on replicating with the public npm repo, or maybe wants to zip up their .couch file and put it on bittorrent, I'm all ears, haha. I'm really hoping StrongLoops additions to NPM work out well (see http://blog.strongloop.com/whats-new-in-strong-loop-node-beta-3-private-repositories/) and someone will create an 'enterprise' repo a la Nexus/Artifactory. andy On Thu, May 16, 2013 at 6:50 PM, Kevin Sawicki kevinsawi...@gmail.comwrote: Hi Andy, I'm also seeing the exact same issue trying to replicate isaacs.iriscouch.com to another iriscouch.com database, it gets stuck at 17,286 documents (16gb) and those errors start to appear in the log. Have you found any more details about this issue? Sincerely, Kevin On Monday, May 13, 2013 8:16:51 PM UTC-7, andy wrote: Based on the awesome feedback I got from https://groups.google.** com/d/msg/nodejs/sX4mbsRPwls/**WtDDE-To2o4Jhttps://groups.google.com/d/msg/nodejs/sX4mbsRPwls/WtDDE-To2o4J, we tried replicating the npm repo so we could use it in an offline environment. We're essentially following the instructions at http://clock.co.uk/tech-* *blogs/how-to-create-a-private-**npmjs-repositoryhttp://clock.co.uk/tech-blogs/how-to-create-a-private-npmjs-repositorybut replication fails after syncing about 17k documents. We've tried reinstalling couch (found one issue that suggested using a patched version of SpiderMonkey) but the same thing keeps happening, even after restarting replication several times. Here's our setup: CentOS 6.4 CouchDB 1.3 SpiderMonkey 1.8.5-7 Replication works fine for over 17,000 documents, then we see this error and can't get past it: [Sat, 11 May 2013 00:55:39 GMT] [error] [0.12970.4] Replicator: couldn't write document `bufferhelper`, revision `19-** d339684ee7f5eaf4cc18d84da75383**2d`, to target database `registry`. Error: `unauthorized`, reason: `Please log in before writing to the db`. Any ideas? Thanks, Andy -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [nodejs] Re: Any suggestions for running mocha tests multiple times against different scenarios?
I'll check that out, thanks. Right now I'm doing something like: function describeFruit(type) { describe(fruit of +type.name, function() { it(should be juicy, function() { assert(type.juicy); });});} describeFruit(apple); -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[nodejs] Re: inj - KISS, require based dependency injector (DI) for node.js
I really dont get these things, why not just define ./log.js and do module.exports = require('my-chosen-log-module'); We expose stuff with NODE_PATH=lib so require('log') in that case but delegate to some other module or apply some thin wrappers. This is pretty common but all this DI stuff just seems to complicate something pretty simple On May 16, 9:48 am, mgutz mario.l.gutier...@gmail.com wrote: https://github.com/mgutz/inj I didn't like all the AngularJS wannabes. node.js has perfectly fine module system already. Inj is a KISS, require based dependency injector (DI) for node.js - no monkey patches - no autowire needed, just use require *reader.js* require = require('inj')(module, require); var fs = require('fs'); exports.text = fs.readFileSync(__dirname + './file.txt', 'utf8'); *readerTest.js* // first create container for `reader` var inj = require('inj'); var container = inj.create(require.resolve('./reader')); // register a mocked 'fs' container.register('fs', {readFileSync: function() { return 'foo'; }); var a = require('./reader'); assert(a.text, 'foo'); -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[nodejs] Re: Sending Custom Headers from Client to Server
Hi Thanks for your reply. I updated my express version to 3.2.4. and my nodejs version is 0.8.11. I tried now, even I couldn't. May I know which version of nodejs and express you are using. Can you share the example codes which you tried. Ramesh On Thursday, 16 May 2013 18:18:35 UTC+5:30, greelgorke wrote: i trieyd out, it works for me: console.log(emp_value:+request.headers['custom_header']); *//** emp_value:head_val* Am Donnerstag, 16. Mai 2013 12:33:19 UTC+2 schrieb Rams B: Hi All, I am trying sending some Custom Headers from Client to Server. The following ajax call is capable to send header information to server. *Client AJAX Call:* $.ajax({ type: GET, url: ws_url, dataType: jsonp, headers:{ custom_header:head_val }, success: function(data) { alert(data) } }); With above ajax call, I can get the header information at server end using JAVA based Apache CXF Web Services like below: String client_custom_header = HttpHeaders.getRequestHeaders().getFirst(custome_header); //I am getting the header value head_val. If I am trying to implement same thing in node.js with express frame work; I cannot read the headers info. * Please find my node.js code:* var https = require('http'); var express = require('express') var app = express.createServer(); var allowCrossDomain = function(req, res, next) { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With'); }; app.configure(function () { app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(app.router); // app.use(allowCrossDomain); app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); }); app.get('/getData', function(request, response){ console.log('STATUS: ' + response.getHeader('custom_header'));//undefined console.log('HEADERS: ' + JSON.stringify(response.headers));//undefined console.log(emp_value:+request.headers['custom_header']); //undefined console.log(\n\n*111***+request.body); //undefined console.log('params: ' + JSON.stringify(request.params));//[] console.log('header: ' + JSON.stringify(request.header(Access-Control-Allow-Origin, *)));//* console.log('body: ' + JSON.stringify(request.body));//undefined console.log('query: ' + JSON.stringify(request.query));//{d:20} console.log('query: ' + request.query.d);//20 }); app.listen(8889); - I tried several options but I couldn't. Please help me soon. Thanks in advance.. Ramesh -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.