- 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
Mayank Agarwal has Published 380 Articles
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
Mayank Agarwal
2K+ Views
req.ip consists of the remote IP address from where the request is received. The value of this property is taken from the leftmost entry in the x-forwarded-for header when the trust proxy settings are not set to False. The headers are set by the client or proxy.Syntaxreq.ipExample 1Create a file ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
Mayank Agarwal
1K+ Views
The req.baseUrl property returns the router instance where this URL path is mounted. This property is similar to the mountpath property of the app object, except for the difference that app.mountpath returns the matched path patterns.Syntaxreq.baseUrlExample 1Create a file with the name "reqBaseUrl.js" and copy the following code snippet. After ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
Mayank Agarwal
3K+ Views
The res.end() method ends the current response process. This method is used to quickly end the response without any data. If one needs to respond with data, they should use either the res.send() method or the res.json() method.Syntaxres.end([data], [encoding])Default encoding is 'utf-8'.Example 1Create a file with the name "resEnd.js" and ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
Mayank Agarwal
967 Views
The 'shortId' package from NPM can be used to create short non-sequential URL-friendly unique ID's. By default, it returns a 7-14 URL-friendly characters from the following categories: "A-Z, a-z, 0-9, _, -". This package also supports clusters (automatically), custom seeds, and custom alphabets. It can generate any number of ID's ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
Mayank Agarwal
9K+ Views
In Express.js, you can directly use the req.query() method to access the string variables. As per the documentation, the req.param method only gets the route parameters, whereas the req.query method checks the query string parameters. For example, "?id=12" checks urlencoded body params.Syntaxreq.query( )Example 1Create a file with the name "reqQuery.js" ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
Mayank Agarwal
444 Views
The req.acceptsLanguage() method returns the first accepted language out of the specified languages based on the request's Accept-Language HTTP header field. This method returns 'false' if none of the specified language is accepted.Syntaxreq.acceptsLanguage ( lang, [...] )Example 1Create a file with the name "reqLang.js" and copy the following code snippet. ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
Mayank Agarwal
138 Views
The req.acceptsCharsets() method returns the first accepted charset of the specified charset sets. These charsets are based on the request's Accept-Charset HTTP header field. By default, it returns 'false' if none of the specified charsets is accepted.Syntaxreq.acceptsCharsets ( charset, [...] )Example 1Create a file with the name "reqAcceptsCharsets.js" and copy ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
Mayank Agarwal
662 Views
The req.accepts() method checks if the specified content-types are acceptable by the request's Accept HTTP header fields. This method returns the best match, and returns False if none of the specified content types is acceptable.The type values can be a MIME type like application/json, or an extension name like json.Syntaxreq.accepts( ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
Mayank Agarwal
6K+ Views
express.urlencoded() is a built-in middleware in Express.js. The main objective of this method is to parse the incoming request with urlencoded payloads and is based upon the body-parser.This method returns the middleware that parses all the urlencoded bodies.Syntaxexpress.urlencoded( [options] )ParametersFollowing are the different options available with this method −options −inflate ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
Mayank Agarwal
3K+ Views
A Student grade calculator is used for taking the grades input for all subjects and then calculating the percentage based upon the marks of the students. This calculator returns a fairly reliable indicator of student results.The simple formula for calculating grades is:$\text{Percentage}=\frac{\text{Marks Scored}}{\text{Total Marks}}\times 100$We are going to take the ... Read More