Auto Added by WPeMatico

Upgrade your JavaScript debugging with debugger

Why I stopped using console.logPhoto by Caspar Rubin on UnsplashTL/DRDebugger is amazing. console.log is lazy.BackgroundI’ve been developing javascript “stuff” for about 2 years now. I recently got way more serious into Node and thus needed much better tools at my disposal. For the purpose of debugging, I was throwing around console.logs like they were candy.You get a console.log and you get one, and you get one!But I knew there had to be a better way. In comes in…

Continue Reading

REST API: How to search for other attribute

ProblemI use node.js as REST API. There are following actions available:/contacts, GET, finds all contacts/contacts, POST, creats new contact/contacts/:id, GET, shows or gets specifiy contact by it’s id/contacts/:id, PUT, updates a specific contact/contacts/:id, DELETE, removes a specific contactWhat would now be a logic Route for searching, quering after a user? Should I put this to the 3. route or should I create an extra route?Problem courtesy of: dev.pusSolutionI’m sure you will get a lot of different opinions on this question. Personally…

Continue Reading

Using node-inspector with Grunt tasks

ProblemDoes someone used node-inspector with Grunt for application debugging? If not, Can you recommend a debugging tool for Grunt based apps?I’m working with nodejs for a server side app and I have Grunt to use separated tasks (this is because users can execute tasks separately).Thanks in advanceProblem courtesy of: blackdragonSolutionTo run grunt in debug, you need to pass the grunt script to node explicitly:node-debug $(which grunt) taskand put a debugger; line in your task. node-inspector will…

Continue Reading

Using Everyauth/Express and Multiple Configurations?

ProblemI’m successfully using Node.js + Express + Everyauth ( https://github.com/abelmartin/Express-And-Everyauth/blob/master/app.js ) to login to Facebook, Twitter, etc. from my application.The problem I’m trying to wrap my head around is that Everyauth seems to be “configure and forget.” I set up a single everyauth object and configure it to act as middleware for express, and then forget about it. For example, if I want to create a mobile Facebook login I do:var app = express.createServer();everyauth.facebook .appId('AAAA')…

Continue Reading

Meteor Create HelloWorld

ProblemThese are the steps I am executing:# meteor create helloworld# cd helloworld# meteorTerminal displays Running on: http://localhost:3000/I point the browser to http://localhost:3000/Everything looks ok in the browser, I see Hello World!. I click on the [Click] button. Nothing happens, no alert in browser. I switch to the terminal anticipating to see You pressed the button but all I see is Running on: http://localhost:3000/ I don't see You pressed the button anywhere in client or server.So…

Continue Reading

Searching for xpath expression with colon in attribute name throws exception (node.js

Searching for xpath expression with colon in attribute name throws exception (node.js elementtree module)ProblemUsing the elementtree package in nodejs, I’m trying to verify the existence of a certain xml attribute in an xml file (specifically an android manifest file).var manifestTxt = fs.readFileSync('AndroidManifest.xml', 'utf-8'), manifestDoc = new et.ElementTree(et.XML(manifestTxt)), expected = 'application/activity[@android:name="com.whatever.app"]';test.ok(manifestDoc.find(expected));I’m getting the following exception:node_modules/elementtree/lib/elementpath.js:210 throw new SyntaxError(token, 'Invalid attribute predicate'); ^Error: Invalid attribute predicateIt doesn’t seem to like the colon in the attribute name, but…

Continue Reading

Where are some good examples displaying dynamic data within Express.js

ProblemI’m working my way through displaying various data elements from parent & child data, with repeating data, paged, data, etc. I was wondering what the best sites are with tutorials or other information related to this. I’m working on this primarily with Express.js, Jade and would like to primarily stick to those, maybe using additional tools like knockout.js or backbone.js if reasonable.CheersProblem courtesy of: AdronSolutionFor general node.js purpose, I find http://howtonode.org/ very informative, up to date.For…

Continue Reading

Global Node Modules without sudo

Short post about how to better manage Node Modules Installation for your NodeJS Projects.It will not only let you install Node Modules without using root privileges but it will also ensure the following benefits of a well managed NodeJS Project:Specific Node versions for specific projectsSpecific Node Modules versions for specific projectsSelf-sufficient package.json, no prerequisite needed before npm installBackground issueWhen installing Node Modules globally with npm, you will encounter EACCESS npm errors:$ npm install -g whatever[...]npm WARN checkPermissions Missing write…

Continue Reading

Nodejs Update leaves old version as current

ProblemSo I am trying to update NodeJS and running into issues. First I tried using nvm to update. I installed a new version, and I can use the new version manually, but nvm ls still showsv0.6.14current: v0.4.12default -> 0.6 (-> v0.6.14)nvm use on the new version doesn't do anything to change this message. nvm uninstall on the old version says I can't unstall the currently-active node version (isn't this what nvm use is supposed to do?).So…

Continue Reading

process.env.NODE_ENV is undefined

ProblemI’m trying to follow a tutorial on NodeJs. I don’t think I missed anything but whenever I call the process.env.NODE_ENV the only value I get back is undefined. According to my research the default value should be 'development'. How is this value dynamically set and where is it set initially?Problem courtesy of: bashepsSolutionprocess.env is a reference to your environment, so you have to set the variable there.To set an environment variable in Windows:SET NODE_ENV=developmenton OS X or Linux:export…

Continue Reading
Close Menu
Skip to toolbar