Unit 1- Introduction to Nodejs
Unit 1- Introduction to Nodejs
2. Why Node.js?
Delete Files
To delete a file with the File System module, use the fs.unlink()
method.
Rename Files
To rename a file with the File System module, use the
fs.rename() method.
11. Json data?
JSON means JavaScript Object Notation. JSON is an open standard
lightweight format for data interchange. JSON is a format for storing
and transporting data consisting of comma-separated attribute-value
pairs and array data types. JSON is commonly used to send the
information from a server to a web page.
Objects are wrapped within '{' and '}'. Arrays are enclosed by '['
and ']'. Objects are a list of label-value pairs. Arrays are list of
values.
Both objects and arrays can be nested.
Strings, numbers, Booleans (i.e true and false) and null can be used
as values.
13. Http Server and Client?
A Web Server is a software application which handles HTTP requests
sent by the HTTP client, like web browsers, and returns web pages in
response to the clients. Web servers usually deliver html documents
along with images, style sheets, and scripts.
Most of the web servers support server-side scripts, using scripting
languages or redirecting the task to an application server which retrieves
data from a database and performs complex logic and then sends a result
to the HTTP client through the Web server.
Web Application Architecture
A Web application is usually divided into four layers −
Server − This layer has the Web server which can intercept the requests
made by the clients and pass them the response.
Data − This layer contains the databases or any other source of data.
14. Error Handling in Nodejs?
Node.js applications experience four types of errors.
EJS Features?
Very Simple Syntax
Use Plain JavaScript
Very Fast Compilation and Execution
Compiles with Express View system
Caching for template and intermediate JavaScript
Includes feature available
Easy Debugging