Posts

Showing posts from March, 2020

RESTful Web Services with Node.js and Express

What APIs? APIs (Application Programming Interfaces) allow consistent communication between software applications and other pieces of software. Either to connect internally to an application component, or to connect externally to a service. The production of API- based modules and services is also a great way to achieve scalability and flexibility, because it allows us to build several applications based on modular and interchangeable modules, enabling scalability and maintenance facilitation. Node.js Node.js is a server-side programming environment operating on JavaScript. Within that framework, we can use JavaScript to create our apps, our REST APIs, and use its APIs to invoke external services. This point is especially supporting more robust front-end applications, most backend services are now being built as simple APIs. If it’s online, mobile, or desktop, they are all feeding back to a single API. Developers should already familiar with JavaScript, making the t...

ReactJS Props Validation

If we need immutable data in our component, we can simply add props to reactDOM.render() function in main.js and use them within our component. Validation of properties is a valuable way of forcing good use of the components. This will help to avoid potential bugs and problems during development, once the application is larger. It also makes the code more readable, since we can see how to use every variable. Custom validators and collections We can also use custom validation functions with PropTypes.arrayOf and PropTypes.objectOf . Used in this way, the custom validation function will be called for each key in the array or object. Nevertheless, instead of three custom validation features will take five arguments.   propValue : The array of object itself key : The key of the current item in the iteration   componentName : The name of the component   location : The location of the validated data. It is usually “prop” propFullName : The fully resolv...