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( types )Example 1Create a file with the name "reqAccepts.js" and copy the following code snippet. After creating the file, use the command "node reqAccepts.js" to run this code as shown in the example below −// req.accepts() Method Demo Example // Importing the express module var express = require('express'); // ... Read More
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 − This enables or disables the handling of the deflated or compressed bodies. Default: truelimit − This controls the maximum size of the request body.extended − This option allows to choose between parsing the URL encoded data with the queryString Library or the qs Library.type − This determines the media ... Read More
A low-pressure mercury vapor gas discharge lamp that uses fluorescence effect to produce visible light is known as fluorescent lamp or fluorescent tube.There are some common faults in case of the fluorescent lamps. These faults, their reasons and treatment methods are described in the following table −Type of FaultReasons of FaultTreatment or Repairing MethodsThe fluorescent lamp does not start.Loose and defective holders.Defective fluorescent tube.Defective starter switch.Defective choke.Turn the tube through 90° and check the connections and holders.Replace the tube.Try another starter switch / replace the starter switch.Replace the choke.Fluorescent lamp blinking ON and OFFLoose contacts.Wrong circuit connections.Low supply voltageDefective starter.Defective ... Read More
For HTML5 Canvas degree symbol, try to run the following code − body { margin:5em; background:#eee; text-align:center } canvas { background:#fff; border:2px solid #ccc; display:block; margin:3em auto } var c = document.getElementsByTagName('canvas')[0]; c.width = c.height = 300; var context = c.getContext('2d'); context.font = "20px sans-serif"; context.fillText("212° Fahrenheit", 100, 100);
What is Butt Welding?Butt welding is one of the simplest and versatile resistance welding process. In the butt welding process, heat is produced by the contact resistance between two metal workpieces. The faces of the workpieces should be machined or edge prepared.The circuit diagram for butt welding process is shown in the figure.In butt welding, the two workpieces are brought together and mechanical pressure is applied along the axial direction by a spring.A welding transformer is used that is having larger number of turns in the primary winding and smaller number of turns in secondary winding.A heavy current is passed ... Read More
The process of deposition of an oxide film on a metal surface is known as anodizing. The anodizing is an electrolytic passivation process, mainly used to increase the thickness of the natural oxide layer on the surface of the metal.This process is called anodizing because the metal part to be treated forms the anode electrode of the electric circuit of the process. The anodizing increases the corrosion resistance and wear resistance and provides better adhesion for paint primers and glues as compared to the bare metal.Requirements of AnodizingThe anodizing of metals is used for the following requirements −To provide the ... Read More
An electric light bulb or lamp that produces light by heating a filament wire to a high temperature until it glows is known as incandescent bulb. The incandescent bulb was invented by an American inventor, named Thomas Alva Edison.The incandescent bulb is an electric lamp that works on the principle of incandescence that means it emits light by the heating of a filament. The incandescent lamps come in different sizes with different voltages and wattages.Construction of Incandescent LampThe construction and the parts of an incandescent lamp is shown in the figure below.The most important part of the incandescent lamp is ... Read More
An electric heating appliance that is used to heat up water is known as electric water heater. The electric water heater brings cold water in through the dip tube and heats this water using the heat produced by an electric heating element and the heated water taken out through outlet pipes.Electric water heaters are classified into three types viz. −Normal Plate HeaterImmersion HeaterGeyser Water HeaterLet's check each of these types of water heaters in detail.Normal Plate HeaterThe normal plate water heater is the simplest types of water heater. It consists of two round shaped plates made up of nickel. These ... Read More
A sodium vapor lamp is type of gas-discharge lamp that uses sodium (Na) in an exciting condition to produce light of thick blue color. The first sodium vapor lamp was commercially designed by Philips in 1932 in Holland.Circuit Diagram of Sodium Vapor LampThe circuit diagram and the construction of a sodium vapor lamp is shown in the figure below.As the sodium vapor lamp is a lamp of low luminosity, its length is large. To get the desired length, the sodium vapor lamp is made in the form of a U-tube. It has two oxide-coated electrodes which are sealed with the ... Read More
A gas discharge lamp that uses an electric arc through the vaporized mercury to produce light is known as mercury vapor lamp. The operation of the mercury vapor lamp is based on the excitation of atom of some gaseous medium. Also, the frequency and the wavelength of the radiation given out by different atoms of the gaseous medium depend upon the level of their excitation.Construction of Mercury Vapor LampThe construction and circuit for a mercury vapor lamp is shown in the figure below.It consists of an inner tube containing mercury vapor and it is made of hard glass.It also has ... Read More