- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Shyam Hande has Published 72 Articles
![Shyam Hande](https://www.tutorialspoint.com/assets/profiles/128761/profile/60_142227-1566966350.jpg)
Shyam Hande
2K+ Views
Now we have an App.js file shown below, we want to redirect the user back to ‘/’ once user name is received by node server. We will store user name in a file named username.txtInitial App.js file −const http = require('http'); const server = http.createServer((req, res)=>{ const url = ... Read More
![Shyam Hande](https://www.tutorialspoint.com/assets/profiles/128761/profile/60_142227-1566966350.jpg)
Shyam Hande
1K+ Views
Routing http requests is important because we want to execute different business rules based on request url and the responses will be different for each routes.Earlier we saw, we can get the url by request.url in node. Simple example of user name input with routes is shown below −const http ... Read More
![Shyam Hande](https://www.tutorialspoint.com/assets/profiles/128761/profile/60_142227-1566966350.jpg)
Shyam Hande
821 Views
App.js −const http = require('http'); const server = http.createServer((req, res)=>{ console.log(req.url, req.method, req. headers); }); server.listen(3000);As shown in above example code, we have request and response parameter object as an argument in createServer method.Response (res) object will be used to send back data to client. It has many properties, ... Read More
![Shyam Hande](https://www.tutorialspoint.com/assets/profiles/128761/profile/60_142227-1566966350.jpg)
Shyam Hande
233 Views
App.jsconst http = require('http'); const server = http.createServer((req, res)=>{ console.log(req); }); server.listen(3000);Run it with command: node App.jsWe can see what is inside a request object by opening a browser and navigating to localhost:3000There is lots of information which will get printed on console window. We will see some important ... Read More
![Shyam Hande](https://www.tutorialspoint.com/assets/profiles/128761/profile/60_142227-1566966350.jpg)
Shyam Hande
1K+ Views
Simple http server in node.js will register an event loop which will keep on listening for http requests.Execution of file containing code for creation of server will work as shown below −node App.js => Start executing script => Code parsing, Register events and functions => event loop=> keeps on running ... Read More
![Shyam Hande](https://www.tutorialspoint.com/assets/profiles/128761/profile/60_142227-1566966350.jpg)
Shyam Hande
417 Views
The mostly used core modules of Node.js are −http − used to launch a simple server, send requestshttps − used to launch a ssl secured http serverpath − used to handle path based on operating systemfs − It’s a file system handling moduleos − its used for os related operationsLets ... Read More
![Shyam Hande](https://www.tutorialspoint.com/assets/profiles/128761/profile/60_142227-1566966350.jpg)
Shyam Hande
228 Views
JSX simply creates a React element using createElement method in the end.Example Submit Will be converted to −React.createElement( FormButton, {color: 'green', buttonSize: 10}, 'Submit’ )Self-closing tags are also possible to add.Capitalizing the custom React ElementThe custom react element must be named with first character in capital so ... Read More
![Shyam Hande](https://www.tutorialspoint.com/assets/profiles/128761/profile/60_142227-1566966350.jpg)
Shyam Hande
154 Views
Higher order component in short called as hoc. It’s a pattern which receives a component and returns a new component with add-on features to it.//hoc is the name of a custom JavaScript functionconst AddOnComponent= hoc(SimpleComponent);We use component with state and/or props to build an UI. Similar way a hoc builds ... Read More
![Shyam Hande](https://www.tutorialspoint.com/assets/profiles/128761/profile/60_142227-1566966350.jpg)
Shyam Hande
389 Views
Most of the times we need to return multiple elements from a component. React Fragment helps in returning multiple elements. The other alternative is to use a html element like div to wrap them. But using extra html node can cause some semantic issues.Example of React.Fragmentrender() { return ( ... Read More
![Shyam Hande](https://www.tutorialspoint.com/assets/profiles/128761/profile/60_142227-1566966350.jpg)
Shyam Hande
312 Views
Passing a ref to the child component is called as forwarding ref. React provides a createRef function to create a ref for element.forwardRef is a function to pass the ref to child component.Example// ExampleRef.js const ExampleTextInput = React.forwardRef((props, ref) => ( )); const exampleInputRef = React.createRef(); class NewTextInput ... Read More