Awesome explanation: https://stackoverflow.com/questions/31354559/using-node-js-require-vs-es6-import-export
Took a snapshot of the Stack Overflow Question and Answer just in case if in case I won't find that page again:
Tuesday, September 19, 2017
Saturday, September 16, 2017
REST in peace
Say, you have some data in a database and you want to manipulate it. You do that through one of the CRUD operations. But you need an interface to perform these actions like a command prompt where a CLI (Command Line Interface) is available for that database, or a GUI interface, etc.
Suppose you want to carry out these data manipulations remotely, how do you do it? Again, you either VPN into the machine where you have access to this database and carry out the operations. Or, if you have an online application, you can access on a browser and carry out these operations.
What if you don't have an online application but just got couple of URLs that could help you to manipulate your data thru http protocol from a remote machine?
So you build an application that provides these URLs so that anybody who wants to get the data, insert the data, update the data, or delete the data can use them thru http access. You build one URL that helps user to insert/get/delete the data based on the HTTP request method. This URL is called as a Representational State Transfer Service or a REST Service.
- What is REST stands for?
- REST stands for Representational State Transfer.
- A REST Service is used to manipulate the state of data through HTTP protocol.
- Following is the match between HTTP requests and CRUD actions.
- HTTP request POST - Create
- HTTP request GET - Read
- HTTP request PUT - Update
- HTTP request DELETE - Delete
- So how do you build a REST Service?
- You can build a REST Service in multiple ways some of which include a Spring boot application, a NodeJS application, etc.
- All you got to remember while building a REST service is to obey the HTTP request types. So when a POST REST service is made for example, your application should receive the data and do some create/insert process.
- What is the Spring Boot REST service application architecture looks like?
- There will be a REST Controller that declares the name of the REST service and attaches it to a service java class that would perform the CRUD operations.
- Example sites to build a REST service using NodeJS and also Spring Boot?
Friday, September 15, 2017
Thursday, September 14, 2017
Answers to Dummies
Why JavaScript classes have only methods?
Because a class definition always defines prototype methods. Class variables are possible, but you wouldn't use prototype to set them.
What is a callback function?
Developer will call a method and pass a function (as an argument) that will get called back by the underlying implementation.
Because a class definition always defines prototype methods. Class variables are possible, but you wouldn't use prototype to set them.
What is a callback function?
Developer will call a method and pass a function (as an argument) that will get called back by the underlying implementation.
JavaScript Testing
More than one year old, but this blog is still my heart winner!!
Read more: http://thejsguy.com/2015/01/12/jasmine-vs-mocha-chai-and-sinon.html
Some other useful links:
http://sinonjs.org/
https://facebook.github.io/ jest/
https://medium.com/powtoon- engineering/a-complete-guide- to-testing-javascript-in-2017- a217b4cd5a2a
http://blog.testdouble.com/ posts/2016-03-13-testdouble- vs-sinon
Read more: http://thejsguy.com/2015/01/12/jasmine-vs-mocha-chai-and-sinon.html
Some other useful links:
http://sinonjs.org/
https://facebook.github.io/
https://medium.com/powtoon-
http://blog.testdouble.com/
Tuesday, September 5, 2017
How to push a NodeJS application to Heroku
Start with these simple instructions:
https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction
And look for the very short-cut instructions here :)
https://dev.to/smithmanny/deploy-your-react-app-to-heroku-2b6f
Also, look at this article to push nodejs, express app to heroku in 10 steps:
https://medium.com/@grantspilsbury/build-and-deploy-a-node-express-server-to-heroku-in-10-steps-70c936ab15dc
https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction
And look for the very short-cut instructions here :)
https://dev.to/smithmanny/deploy-your-react-app-to-heroku-2b6f
Also, look at this article to push nodejs, express app to heroku in 10 steps:
https://medium.com/@grantspilsbury/build-and-deploy-a-node-express-server-to-heroku-in-10-steps-70c936ab15dc
Sunday, September 3, 2017
JSON Schema Validator - Some examples
Online JSON Schema Validator: http://www.jsonschemavalidator.net/
And practice these examples: https://json-schema-validator-examples.herokuapp.com
And practice these examples: https://json-schema-validator-examples.herokuapp.com
Subscribe to:
Posts (Atom)