Came across this tutorial. Very self explanatory!!
Here is the simple and best example: https://alligator.io/nodejs/express-basics/
https://scotch.io/tutorials/learn-to-use-the-new-router-in-expressjs-4
https://codeforgeek.com/2015/05/expressjs-router-tutorial/
Thursday, January 12, 2017
Friday, December 16, 2016
Git branches
Found another good web site where I found good examples on Git branches!
https://www.atlassian.com/git/tutorials/using-branches
https://www.atlassian.com/git/tutorials/using-branches
Thursday, December 15, 2016
Git major commands
Came across this web site where they listed all the major Git commands:
https://www.siteground.com/tutorials/git/commands.htm
https://www.siteground.com/tutorials/git/commands.htm
Sunday, December 11, 2016
NodeJS, express and Jasmine
Click here for the Introduction page at Jasmine
Here's an easy to follow tutorial/blog on how to test using Jasmine-node. There are couple of typos and issues with the code there but it definitely helps if you are novice node, express, and Jasmine guy!
https://semaphoreci.com/community/tutorials/getting-started-with-node-js-and-jasmine
https://github.com/mhevery/jasmine-node#async-tests
https://evanhahn.com/how-do-i-jasmine/
Also, the Jasmine assertions can be found here:
https://jasmine.github.io/2.0/introduction.html#section-Included_Matchers
And here is the awesome web site where the basics of Jasmine were demystified:
http://www.htmlgoodies.com/html5/javascript/spy-on-javascript-methods-using-the-jasmine-testing-framework.html
Here's an easy to follow tutorial/blog on how to test using Jasmine-node. There are couple of typos and issues with the code there but it definitely helps if you are novice node, express, and Jasmine guy!
https://semaphoreci.com/community/tutorials/getting-started-with-node-js-and-jasmine
https://github.com/mhevery/jasmine-node#async-tests
https://evanhahn.com/how-do-i-jasmine/
Also, the Jasmine assertions can be found here:
https://jasmine.github.io/2.0/introduction.html#section-Included_Matchers
And here is the awesome web site where the basics of Jasmine were demystified:
http://www.htmlgoodies.com/html5/javascript/spy-on-javascript-methods-using-the-jasmine-testing-framework.html
Monday, November 14, 2016
React Redux
- Redux has no relation to React.
- Redux works really well when you use a library (like React) that let you describe UI as a function of state, and Redux emits state updates as a response to user actions.
- Read here, https://github.com/reactjs/react-redux/blob/master/docs/api.md#provider-store about Redux API.
React Router (react-router-dom)
To implement routing in a ReactJS application...
Recently stumbled across this blog which is an interesting read on react-router-dom:
https://blog.pshrmn.com/simple-react-router-v4-tutorial/
Found this tutorial loaded on GitHub which gives a simple beginning and escalates to advanced level.
I liked the first line in the tutorial..."At its heart React Router is a component, and its not going to display anything until you configure a route". Read and practice the tutorial...
https://github.com/reactjs/react-router-tutorial/tree/master/lessons/02-rendering-a-route
- You need to install react-router-dom
- Use the components BrowserRouter, Route, Switch, Link from react-router-dom module.
- Define the routes and wrap them in BrowserRouter
- Define the links
- and you are ready to go.
npm i react-router-dom --save
Recently stumbled across this blog which is an interesting read on react-router-dom:
https://blog.pshrmn.com/simple-react-router-v4-tutorial/
Found this tutorial loaded on GitHub which gives a simple beginning and escalates to advanced level.
I liked the first line in the tutorial..."At its heart React Router is a component, and its not going to display anything until you configure a route". Read and practice the tutorial...
https://github.com/reactjs/react-router-tutorial/tree/master/lessons/02-rendering-a-route
Another good example:
Friday, November 11, 2016
Using Node.js require vs. ES6 import/export
Read one of the postings on stackoverflow and it gave me that "a-ha" moment.
http://stackoverflow.com/questions/31354559/using-node-js-require-vs-es6-import-export
I am worried that I may lose this posting in stackoverflow so copying the question and answer from there to here for my future reference:
Question:
In a project I'm collaborating on, we have two choices on which module system we can use:
Are there any performance benefits to using one over the other? Is there anything else that we should know if we were to use ES6 modules over Node ones?
Answer:
Keep in mind that there is no JavaScript engine yet that natively supports ES6 modules. You said yourself that you are using Babel. Babel converts import and export declaration to CommonJS (require/module.exports) by default anyway. So even if you use ES6 module syntax, you will be using CommonJS under the hood if you run the code in Node.
There are technical difference between CommonJS and ES6 modules, e.g. CommonJS allows you to load modules dynamically. ES6 doesn't allow this, but there is an API in development for that.
Since ES6 modules are part of the standard, I would use them.
http://stackoverflow.com/questions/31354559/using-node-js-require-vs-es6-import-export
I am worried that I may lose this posting in stackoverflow so copying the question and answer from there to here for my future reference:
Question:
In a project I'm collaborating on, we have two choices on which module system we can use:
- Importing modules using require, and exporting using module.exports and exports.foo
- Importing modules using ES6 import, and exporting using ES6 export
Are there any performance benefits to using one over the other? Is there anything else that we should know if we were to use ES6 modules over Node ones?
Answer:
Keep in mind that there is no JavaScript engine yet that natively supports ES6 modules. You said yourself that you are using Babel. Babel converts import and export declaration to CommonJS (require/module.exports) by default anyway. So even if you use ES6 module syntax, you will be using CommonJS under the hood if you run the code in Node.
There are technical difference between CommonJS and ES6 modules, e.g. CommonJS allows you to load modules dynamically. ES6 doesn't allow this, but there is an API in development for that.
Since ES6 modules are part of the standard, I would use them.
Subscribe to:
Posts (Atom)





