Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology

Ayes Chinmay
Internet
&
Web Technology
(Node.js)
IWT Syllabus:
Module 5:
Node.js
Introduction, Modules in nodejs, HTTP module, File System, URL module, NPM, events, Upload Files,
Email.
JSP
Server Side Programming: Introduction to Java Server Page (JSP), JSP Application Design, JSP objects,
Conditional Processing, Declaring variables and methods, Sharing data between JSP pages, Sharing
Session and Application Data, Database Programming using JDBC, development of java beans in JSP.
Servlet
Introduction to Servlets, Lifecycle, JSDK, Servlet API, Servlet Packages, Introduction to JSF, JSF Basics,
Managed Beans, Navigation, Standard JSF Tags, Data Tables, Conversion and Validation, Event Handling
Node.js:
 Node.js is an open source server environment.
 Node.js allows you to run JavaScript on the server.
 Released on 27th May 2009. (11 years ago)
Ryan Dahl
Node.js:
console.log('This example is different!');
console.log('The result is displayed in
the Command Line Interface');
Index.js var http = require('http');
http.createServer(function (req, res)
{
res.writeHead(200, {'Content-
Type': 'text/plain'});
res.end('Hello World!');
}).listen(8080);
Index.js
http://localhost:8080/
Node.js Modules:
exports.myDateTime = function () {
return Date();
};
var http = require('http');
var dt = require('./time');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type':
'text/html'});
res.write("The date and time are
currently: " + dt.myDateTime());
res.end();
}).listen(8080);
Index.js
time.js
Node.js File System Module:
var http = require('http');
var fs = require('fs');
http.createServer(function (req, res) {
fs.readFile('index.html', function(err,
data) {
res.writeHead(200, {'Content-Type':
'text/html'});
res.write(data);
return res.end();
});
}).listen(8080);
<html>
<body>
<h1>My Header</h1>
<p>My paragraph.</p>
</body>
</html>
Index.js
Index.html
Node.js Send an Email:
var nodemailer = require('nodemailer');
var transporter =
nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'youremail@gmail.com',
pass: 'yourpassword'
}
});
var mailOptions = {
from: 'youremail@gmail.com',
to: 'myfriend@yahoo.com',
subject: 'Sending Email using Node.js',
text: 'That was easy!'
};
transporter.sendMail(mailOptions,
function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
Index.js
https://www.google.com/settings/security/lesssecureappsnpm install nodemailer
GMAIL Less secure app accessCMD
Node.js MySQL Create Database:
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "yourusername",
password: "yourpassword"
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
con.query("CREATE DATABASE mydb", function (err,
result) {
if (err) throw err;
console.log("Database created");
});
});
Index.js
npm install mysql
CMD
Node.js MySQL Create Table:
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "yourusername",
password: "yourpassword",
database: "mydb"
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
var sql = "CREATE TABLE customers (name VARCHAR(255), address VARCHAR(255))";
con.query(sql, function (err, result) {
if (err) throw err;
console.log("Table created");
});
});
Index.js
Node.js MySQL Insert Into:
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "yourusername",
password: "yourpassword",
database: "mydb"
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
var sql = "INSERT INTO customers (name, address) VALUES ('Company Inc', 'Highway 37')";
con.query(sql, function (err, result) {
if (err) throw err;
console.log("1 record inserted");
});
});
Index.js
Node.js MySQL Update:
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "yourusername",
password: "yourpassword",
database: "mydb"
});
con.connect(function(err) {
if (err) throw err;
var sql = "UPDATE customers SET address = 'Canyon 123' WHERE address = 'Valley 345'";
con.query(sql, function (err, result) {
if (err) throw err;
console.log(result.affectedRows + " record(s) updated");
});
});
Index.js
Node.js MySQL Select From:
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "yourusername",
password: "yourpassword",
database: "mydb"
});
con.connect(function(err) {
if (err) throw err;
con.query("SELECT * FROM customers", function (err, result, fields) {
if (err) throw err;
console.log(result);
});
});
Index.js
Node.js MySQL Where:
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "yourusername",
password: "yourpassword",
database: "mydb"
});
con.connect(function(err) {
if (err) throw err;
con.query("SELECT * FROM customers WHERE address = 'Park Lane 38'", function (err,
result) {
if (err) throw err;
console.log(result);
});
});
Index.js
Node.js MySQL Order By:
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "yourusername",
password: "yourpassword",
database: "mydb"
});
con.connect(function(err) {
if (err) throw err;
con.query("SELECT * FROM customers ORDER BY name", function (err, result) {
if (err) throw err;
console.log(result);
});
});
Index.js
Node.js MySQL Delete:
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "yourusername",
password: "yourpassword",
database: "mydb"
});
con.connect(function(err) {
if (err) throw err;
var sql = "DELETE FROM customers WHERE address = 'Mountain 21'";
con.query(sql, function (err, result) {
if (err) throw err;
console.log("Number of records deleted: " + result.affectedRows);
});
});
Index.js
Node.js MySQL Drop Table:
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "yourusername",
password: "yourpassword",
database: "mydb"
});
con.connect(function(err) {
if (err) throw err;
var sql = "DROP TABLE customers";
con.query(sql, function (err, result) {
if (err) throw err;
console.log("Table deleted");
});
});
Index.js
Model Questions:
1. HTML (Hyper Text Markup Language) has language elements,
which permit certain actions other than describing the structure
of the Web document. Which one of the following actions is NOT
supported by pure HTML (without any server or client-side
scripting) pages?
(a) Embed Web objects from different sites into the same page
(b) Refresh the page automatically after a specified interval.
(c) Automatically redirect to another page upon download.
(d) Display the client time as part of the page.
(GATE 2011: 1 Mark)
Solution:
<OBJECT> … </OBJECT> tag is used to
embed web objects.
<META HTTP-EQUIV="Refresh" CONTENT="5">
is used to refresh page after every 5 seconds.
<META HTTP-EQUIV="Refresh" CONTENT="0;
URL=another-page.html"> is used to redirect.
But for displaying the client time, there is no
tag available.
Model Questions: (Cont.)
2. To change the text colour in HTML we use?
(a) Color:
(b) latest—text—color=
(c) modifytextcolor:
(d) newcolor:
3. Which of the following is used to specify border type
(solid or dotted or double line etc.)?
(a) Border-width
(b) Border-attrib
(c) Border-style
(d) Border-layout
Next Class:
JSP
1 de 19

Recomendados

Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology por
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology Ayes Chinmay
183 visualizações23 slides
Internet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web Technology por
Internet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web TechnologyInternet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web TechnologyAyes Chinmay
153 visualizações14 slides
JavaScript and jQuery Basics por
JavaScript and jQuery BasicsJavaScript and jQuery Basics
JavaScript and jQuery BasicsKaloyan Kosev
3.5K visualizações17 slides
Java script por
Java scriptJava script
Java scriptSukrit Gupta
856 visualizações24 slides
22 j query1 por
22 j query122 j query1
22 j query1Fajar Baskoro
809 visualizações23 slides
jQuery por
jQueryjQuery
jQueryDileep Mishra
3.8K visualizações21 slides

Mais conteúdo relacionado

Mais procurados

JavaScript JQUERY AJAX por
JavaScript JQUERY AJAXJavaScript JQUERY AJAX
JavaScript JQUERY AJAXMakarand Bhatambarekar
2.5K visualizações12 slides
Unit 4(it workshop) por
Unit 4(it workshop)Unit 4(it workshop)
Unit 4(it workshop)Dr.Lokesh Gagnani
51 visualizações67 slides
JAVA SCRIPT por
JAVA SCRIPTJAVA SCRIPT
JAVA SCRIPTMohammed Hussein
2.9K visualizações38 slides
Wt unit 2 ppts client side technology por
Wt unit 2 ppts client side technologyWt unit 2 ppts client side technology
Wt unit 2 ppts client side technologyPUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
32 visualizações90 slides
JavaScript por
JavaScriptJavaScript
JavaScriptDoncho Minkov
2.4K visualizações70 slides
SharePoint and jQuery Essentials por
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery EssentialsMark Rackley
12.5K visualizações34 slides

Mais procurados(20)

Unit 4(it workshop) por Dr.Lokesh Gagnani
Unit 4(it workshop)Unit 4(it workshop)
Unit 4(it workshop)
Dr.Lokesh Gagnani51 visualizações
JAVA SCRIPT por Mohammed Hussein
JAVA SCRIPTJAVA SCRIPT
JAVA SCRIPT
Mohammed Hussein2.9K visualizações
JavaScript por Doncho Minkov
JavaScriptJavaScript
JavaScript
Doncho Minkov2.4K visualizações
SharePoint and jQuery Essentials por Mark Rackley
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery Essentials
Mark Rackley12.5K visualizações
React.js触ってみた 吉澤和香奈 por Wakana Yoshizawa
React.js触ってみた 吉澤和香奈React.js触ってみた 吉澤和香奈
React.js触ってみた 吉澤和香奈
Wakana Yoshizawa2.7K visualizações
1 ppt-ajax with-j_query por Fajar Baskoro
1 ppt-ajax with-j_query1 ppt-ajax with-j_query
1 ppt-ajax with-j_query
Fajar Baskoro1.9K visualizações
Simplify AJAX using jQuery por Siva Arunachalam
Simplify AJAX using jQuerySimplify AJAX using jQuery
Simplify AJAX using jQuery
Siva Arunachalam5K visualizações
JavaScript and BOM events por Jussi Pohjolainen
JavaScript and BOM eventsJavaScript and BOM events
JavaScript and BOM events
Jussi Pohjolainen2.6K visualizações
Java script Advance por Jaya Kumari
Java script   AdvanceJava script   Advance
Java script Advance
Jaya Kumari65 visualizações
jQuery por Vishwa Mohan
jQueryjQuery
jQuery
Vishwa Mohan3.3K visualizações
Knockout.js por Vivek Rajan
Knockout.jsKnockout.js
Knockout.js
Vivek Rajan11.7K visualizações
JavaScript & Dom Manipulation por Mohammed Arif
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
Mohammed Arif7.9K visualizações
Javascript: Ajax & DOM Manipulation v1.2 por borkweb
Javascript: Ajax & DOM Manipulation v1.2Javascript: Ajax & DOM Manipulation v1.2
Javascript: Ajax & DOM Manipulation v1.2
borkweb2.3K visualizações
Java script tutorial por Doeun KOCH
Java script tutorialJava script tutorial
Java script tutorial
Doeun KOCH502 visualizações
JavaScript: Ajax & DOM Manipulation por borkweb
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulation
borkweb8.9K visualizações
jQuery Introduction por Arwid Bancewicz
jQuery IntroductionjQuery Introduction
jQuery Introduction
Arwid Bancewicz1.6K visualizações
JS basics por Mohd Saeed
JS basicsJS basics
JS basics
Mohd Saeed650 visualizações
jQuery -Chapter 2 - Selectors and Events por WebStackAcademy
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events
WebStackAcademy211 visualizações

Similar a Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology

NoSQL and JavaScript: a Love Story por
NoSQL and JavaScript: a Love StoryNoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love StoryAlexandre Morgaut
9.3K visualizações36 slides
harry presentation por
harry presentationharry presentation
harry presentationthembhani mapengo
279 visualizações26 slides
Writing robust Node.js applications por
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
15.6K visualizações82 slides
NodeJS por
NodeJSNodeJS
NodeJSAlok Guha
1.6K visualizações21 slides
Converting a Rails application to Node.js por
Converting a Rails application to Node.jsConverting a Rails application to Node.js
Converting a Rails application to Node.jsMatt Sergeant
18.6K visualizações32 slides
Full stack development with node and NoSQL - All Things Open - October 2017 por
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Matthew Groves
368 visualizações52 slides

Similar a Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology (20)

NoSQL and JavaScript: a Love Story por Alexandre Morgaut
NoSQL and JavaScript: a Love StoryNoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love Story
Alexandre Morgaut9.3K visualizações
harry presentation por thembhani mapengo
harry presentationharry presentation
harry presentation
thembhani mapengo279 visualizações
Writing robust Node.js applications por Tom Croucher
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
Tom Croucher15.6K visualizações
NodeJS por Alok Guha
NodeJSNodeJS
NodeJS
Alok Guha1.6K visualizações
Converting a Rails application to Node.js por Matt Sergeant
Converting a Rails application to Node.jsConverting a Rails application to Node.js
Converting a Rails application to Node.js
Matt Sergeant18.6K visualizações
Full stack development with node and NoSQL - All Things Open - October 2017 por Matthew Groves
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017
Matthew Groves368 visualizações
Full Stack Development with Node.js and NoSQL por All Things Open
Full Stack Development with Node.js and NoSQLFull Stack Development with Node.js and NoSQL
Full Stack Development with Node.js and NoSQL
All Things Open451 visualizações
Introduction to Node.js por Somkiat Puisungnoen
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Somkiat Puisungnoen3.8K visualizações
[Coscup 2012] JavascriptMVC por Alive Kuo
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
Alive Kuo1.3K visualizações
Solutions for bi-directional Integration between Oracle RDMBS & Apache Kafka por Guido Schmutz
Solutions for bi-directional Integration between Oracle RDMBS & Apache KafkaSolutions for bi-directional Integration between Oracle RDMBS & Apache Kafka
Solutions for bi-directional Integration between Oracle RDMBS & Apache Kafka
Guido Schmutz575 visualizações
Solutions for bi-directional integration between Oracle RDBMS and Apache Kafk... por confluent
Solutions for bi-directional integration between Oracle RDBMS and Apache Kafk...Solutions for bi-directional integration between Oracle RDBMS and Apache Kafk...
Solutions for bi-directional integration between Oracle RDBMS and Apache Kafk...
confluent1.7K visualizações
Play vs Rails por Daniel Cukier
Play vs RailsPlay vs Rails
Play vs Rails
Daniel Cukier45.7K visualizações
RESTful API In Node Js using Express por Jeetendra singh
RESTful API In Node Js using Express RESTful API In Node Js using Express
RESTful API In Node Js using Express
Jeetendra singh359 visualizações
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011 por Nick Sieger
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
Nick Sieger3.6K visualizações
Integrating React.js Into a PHP Application por Andrew Rota
Integrating React.js Into a PHP ApplicationIntegrating React.js Into a PHP Application
Integrating React.js Into a PHP Application
Andrew Rota108.6K visualizações
OSCON 2011 CouchApps por Bradley Holt
OSCON 2011 CouchAppsOSCON 2011 CouchApps
OSCON 2011 CouchApps
Bradley Holt5.4K visualizações
soft-shake.ch - Hands on Node.js por soft-shake.ch
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
soft-shake.ch2.3K visualizações
Javascript frameworks: Backbone.js por Soós Gábor
Javascript frameworks: Backbone.jsJavascript frameworks: Backbone.js
Javascript frameworks: Backbone.js
Soós Gábor1.2K visualizações
Solutions for bi-directional integration between Oracle RDBMS & Apache Kafka por Guido Schmutz
Solutions for bi-directional integration between Oracle RDBMS & Apache KafkaSolutions for bi-directional integration between Oracle RDBMS & Apache Kafka
Solutions for bi-directional integration between Oracle RDBMS & Apache Kafka
Guido Schmutz870 visualizações
Node.js - async for the rest of us. por Mike Brevoort
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.
Mike Brevoort6.9K visualizações

Mais de Ayes Chinmay

Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC... por
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Ayes Chinmay
183 visualizações17 slides
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol... por
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...Ayes Chinmay
136 visualizações18 slides
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech... por
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...Ayes Chinmay
174 visualizações15 slides
Internet and Web Technology (CLASS-7) [XML and AJAX] | NIC/NIELIT Web Technology por
Internet and Web Technology (CLASS-7) [XML and AJAX] | NIC/NIELIT Web TechnologyInternet and Web Technology (CLASS-7) [XML and AJAX] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-7) [XML and AJAX] | NIC/NIELIT Web TechnologyAyes Chinmay
229 visualizações16 slides
Internet and Web Technology (CLASS-6) [BOM] por
Internet and Web Technology (CLASS-6) [BOM] Internet and Web Technology (CLASS-6) [BOM]
Internet and Web Technology (CLASS-6) [BOM] Ayes Chinmay
275 visualizações15 slides
Internet and Web Technology (CLASS-5) [HTML DOM] por
Internet and Web Technology (CLASS-5) [HTML DOM] Internet and Web Technology (CLASS-5) [HTML DOM]
Internet and Web Technology (CLASS-5) [HTML DOM] Ayes Chinmay
249 visualizações11 slides

Mais de Ayes Chinmay(10)

Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC... por Ayes Chinmay
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Ayes Chinmay183 visualizações
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol... por Ayes Chinmay
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Ayes Chinmay136 visualizações
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech... por Ayes Chinmay
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...
Ayes Chinmay174 visualizações
Internet and Web Technology (CLASS-7) [XML and AJAX] | NIC/NIELIT Web Technology por Ayes Chinmay
Internet and Web Technology (CLASS-7) [XML and AJAX] | NIC/NIELIT Web TechnologyInternet and Web Technology (CLASS-7) [XML and AJAX] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-7) [XML and AJAX] | NIC/NIELIT Web Technology
Ayes Chinmay229 visualizações
Internet and Web Technology (CLASS-6) [BOM] por Ayes Chinmay
Internet and Web Technology (CLASS-6) [BOM] Internet and Web Technology (CLASS-6) [BOM]
Internet and Web Technology (CLASS-6) [BOM]
Ayes Chinmay275 visualizações
Internet and Web Technology (CLASS-5) [HTML DOM] por Ayes Chinmay
Internet and Web Technology (CLASS-5) [HTML DOM] Internet and Web Technology (CLASS-5) [HTML DOM]
Internet and Web Technology (CLASS-5) [HTML DOM]
Ayes Chinmay249 visualizações
Internet and Web Technology (CLASS-4) [CSS & JS] por Ayes Chinmay
Internet and Web Technology (CLASS-4) [CSS & JS] Internet and Web Technology (CLASS-4) [CSS & JS]
Internet and Web Technology (CLASS-4) [CSS & JS]
Ayes Chinmay311 visualizações
Internet and Web Technology (CLASS-3) [HTML & CSS] por Ayes Chinmay
Internet and Web Technology (CLASS-3) [HTML & CSS] Internet and Web Technology (CLASS-3) [HTML & CSS]
Internet and Web Technology (CLASS-3) [HTML & CSS]
Ayes Chinmay286 visualizações
Internet and Web Technology (CLASS-2) [HTTP & HTML] por Ayes Chinmay
Internet and Web Technology (CLASS-2) [HTTP & HTML]Internet and Web Technology (CLASS-2) [HTTP & HTML]
Internet and Web Technology (CLASS-2) [HTTP & HTML]
Ayes Chinmay307 visualizações
Internet and Web Technology (CLASS-1) [Introduction] por Ayes Chinmay
Internet and Web Technology (CLASS-1) [Introduction]Internet and Web Technology (CLASS-1) [Introduction]
Internet and Web Technology (CLASS-1) [Introduction]
Ayes Chinmay340 visualizações

Último

Gross Anatomy of the Liver por
Gross Anatomy of the LiverGross Anatomy of the Liver
Gross Anatomy of the Liverobaje godwin sunday
89 visualizações12 slides
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx por
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptxGuidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptxNiranjan Chavan
42 visualizações48 slides
DISTILLATION.pptx por
DISTILLATION.pptxDISTILLATION.pptx
DISTILLATION.pptxAnupkumar Sharma
75 visualizações47 slides
Meet the Bible por
Meet the BibleMeet the Bible
Meet the BibleSteve Thomason
81 visualizações80 slides
JRN 362 - Lecture Twenty-Three (Epilogue) por
JRN 362 - Lecture Twenty-Three (Epilogue)JRN 362 - Lecture Twenty-Three (Epilogue)
JRN 362 - Lecture Twenty-Three (Epilogue)Rich Hanley
43 visualizações57 slides
UNIDAD 3 6º C.MEDIO.pptx por
UNIDAD 3 6º C.MEDIO.pptxUNIDAD 3 6º C.MEDIO.pptx
UNIDAD 3 6º C.MEDIO.pptxMarcosRodriguezUcedo
150 visualizações32 slides

Último(20)

Gross Anatomy of the Liver por obaje godwin sunday
Gross Anatomy of the LiverGross Anatomy of the Liver
Gross Anatomy of the Liver
obaje godwin sunday89 visualizações
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx por Niranjan Chavan
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptxGuidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx
Niranjan Chavan42 visualizações
DISTILLATION.pptx por Anupkumar Sharma
DISTILLATION.pptxDISTILLATION.pptx
DISTILLATION.pptx
Anupkumar Sharma75 visualizações
Meet the Bible por Steve Thomason
Meet the BibleMeet the Bible
Meet the Bible
Steve Thomason81 visualizações
JRN 362 - Lecture Twenty-Three (Epilogue) por Rich Hanley
JRN 362 - Lecture Twenty-Three (Epilogue)JRN 362 - Lecture Twenty-Three (Epilogue)
JRN 362 - Lecture Twenty-Three (Epilogue)
Rich Hanley43 visualizações
UNIDAD 3 6º C.MEDIO.pptx por MarcosRodriguezUcedo
UNIDAD 3 6º C.MEDIO.pptxUNIDAD 3 6º C.MEDIO.pptx
UNIDAD 3 6º C.MEDIO.pptx
MarcosRodriguezUcedo150 visualizações
BUSINESS ETHICS MODULE 1 UNIT I_A.pdf por Dr Vijay Vishwakarma
BUSINESS ETHICS MODULE 1 UNIT I_A.pdfBUSINESS ETHICS MODULE 1 UNIT I_A.pdf
BUSINESS ETHICS MODULE 1 UNIT I_A.pdf
Dr Vijay Vishwakarma92 visualizações
Creative Restart 2023: Atila Martins - Craft: A Necessity, Not a Choice por Taste
Creative Restart 2023: Atila Martins - Craft: A Necessity, Not a ChoiceCreative Restart 2023: Atila Martins - Craft: A Necessity, Not a Choice
Creative Restart 2023: Atila Martins - Craft: A Necessity, Not a Choice
Taste52 visualizações
Ask The Expert! Nonprofit Website Tools, Tips, and Technology.pdf por TechSoup
 Ask The Expert! Nonprofit Website Tools, Tips, and Technology.pdf Ask The Expert! Nonprofit Website Tools, Tips, and Technology.pdf
Ask The Expert! Nonprofit Website Tools, Tips, and Technology.pdf
TechSoup 62 visualizações
Pharmaceutical Analysis PPT (BP 102T) por yakshpharmacy009
Pharmaceutical Analysis PPT (BP 102T) Pharmaceutical Analysis PPT (BP 102T)
Pharmaceutical Analysis PPT (BP 102T)
yakshpharmacy009116 visualizações
Creative Restart 2023: Leonard Savage - The Permanent Brief: Unearthing unobv... por Taste
Creative Restart 2023: Leonard Savage - The Permanent Brief: Unearthing unobv...Creative Restart 2023: Leonard Savage - The Permanent Brief: Unearthing unobv...
Creative Restart 2023: Leonard Savage - The Permanent Brief: Unearthing unobv...
Taste62 visualizações
STRATEGIC MANAGEMENT MODULE 1_UNIT1 _UNIT2.pdf por Dr Vijay Vishwakarma
STRATEGIC MANAGEMENT MODULE 1_UNIT1 _UNIT2.pdfSTRATEGIC MANAGEMENT MODULE 1_UNIT1 _UNIT2.pdf
STRATEGIC MANAGEMENT MODULE 1_UNIT1 _UNIT2.pdf
Dr Vijay Vishwakarma134 visualizações
What is Digital Transformation? por Mark Brown
What is Digital Transformation?What is Digital Transformation?
What is Digital Transformation?
Mark Brown41 visualizações
EILO EXCURSION PROGRAMME 2023 por info33492
EILO EXCURSION PROGRAMME 2023EILO EXCURSION PROGRAMME 2023
EILO EXCURSION PROGRAMME 2023
info33492208 visualizações
Java Simplified: Understanding Programming Basics por Akshaj Vadakkath Joshy
Java Simplified: Understanding Programming BasicsJava Simplified: Understanding Programming Basics
Java Simplified: Understanding Programming Basics
Akshaj Vadakkath Joshy663 visualizações
JQUERY.pdf por ArthyR3
JQUERY.pdfJQUERY.pdf
JQUERY.pdf
ArthyR3107 visualizações
The Future of Micro-credentials: Is Small Really Beautiful? por Mark Brown
The Future of Micro-credentials:  Is Small Really Beautiful?The Future of Micro-credentials:  Is Small Really Beautiful?
The Future of Micro-credentials: Is Small Really Beautiful?
Mark Brown102 visualizações
REFERENCING, CITATION.pptx por abhisrivastava11
REFERENCING, CITATION.pptxREFERENCING, CITATION.pptx
REFERENCING, CITATION.pptx
abhisrivastava1141 visualizações

Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology

  • 2. IWT Syllabus: Module 5: Node.js Introduction, Modules in nodejs, HTTP module, File System, URL module, NPM, events, Upload Files, Email. JSP Server Side Programming: Introduction to Java Server Page (JSP), JSP Application Design, JSP objects, Conditional Processing, Declaring variables and methods, Sharing data between JSP pages, Sharing Session and Application Data, Database Programming using JDBC, development of java beans in JSP. Servlet Introduction to Servlets, Lifecycle, JSDK, Servlet API, Servlet Packages, Introduction to JSF, JSF Basics, Managed Beans, Navigation, Standard JSF Tags, Data Tables, Conversion and Validation, Event Handling
  • 3. Node.js:  Node.js is an open source server environment.  Node.js allows you to run JavaScript on the server.  Released on 27th May 2009. (11 years ago) Ryan Dahl
  • 4. Node.js: console.log('This example is different!'); console.log('The result is displayed in the Command Line Interface'); Index.js var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content- Type': 'text/plain'}); res.end('Hello World!'); }).listen(8080); Index.js http://localhost:8080/
  • 5. Node.js Modules: exports.myDateTime = function () { return Date(); }; var http = require('http'); var dt = require('./time'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.write("The date and time are currently: " + dt.myDateTime()); res.end(); }).listen(8080); Index.js time.js
  • 6. Node.js File System Module: var http = require('http'); var fs = require('fs'); http.createServer(function (req, res) { fs.readFile('index.html', function(err, data) { res.writeHead(200, {'Content-Type': 'text/html'}); res.write(data); return res.end(); }); }).listen(8080); <html> <body> <h1>My Header</h1> <p>My paragraph.</p> </body> </html> Index.js Index.html
  • 7. Node.js Send an Email: var nodemailer = require('nodemailer'); var transporter = nodemailer.createTransport({ service: 'gmail', auth: { user: 'youremail@gmail.com', pass: 'yourpassword' } }); var mailOptions = { from: 'youremail@gmail.com', to: 'myfriend@yahoo.com', subject: 'Sending Email using Node.js', text: 'That was easy!' }; transporter.sendMail(mailOptions, function(error, info){ if (error) { console.log(error); } else { console.log('Email sent: ' + info.response); } }); Index.js https://www.google.com/settings/security/lesssecureappsnpm install nodemailer GMAIL Less secure app accessCMD
  • 8. Node.js MySQL Create Database: var mysql = require('mysql'); var con = mysql.createConnection({ host: "localhost", user: "yourusername", password: "yourpassword" }); con.connect(function(err) { if (err) throw err; console.log("Connected!"); con.query("CREATE DATABASE mydb", function (err, result) { if (err) throw err; console.log("Database created"); }); }); Index.js npm install mysql CMD
  • 9. Node.js MySQL Create Table: var mysql = require('mysql'); var con = mysql.createConnection({ host: "localhost", user: "yourusername", password: "yourpassword", database: "mydb" }); con.connect(function(err) { if (err) throw err; console.log("Connected!"); var sql = "CREATE TABLE customers (name VARCHAR(255), address VARCHAR(255))"; con.query(sql, function (err, result) { if (err) throw err; console.log("Table created"); }); }); Index.js
  • 10. Node.js MySQL Insert Into: var mysql = require('mysql'); var con = mysql.createConnection({ host: "localhost", user: "yourusername", password: "yourpassword", database: "mydb" }); con.connect(function(err) { if (err) throw err; console.log("Connected!"); var sql = "INSERT INTO customers (name, address) VALUES ('Company Inc', 'Highway 37')"; con.query(sql, function (err, result) { if (err) throw err; console.log("1 record inserted"); }); }); Index.js
  • 11. Node.js MySQL Update: var mysql = require('mysql'); var con = mysql.createConnection({ host: "localhost", user: "yourusername", password: "yourpassword", database: "mydb" }); con.connect(function(err) { if (err) throw err; var sql = "UPDATE customers SET address = 'Canyon 123' WHERE address = 'Valley 345'"; con.query(sql, function (err, result) { if (err) throw err; console.log(result.affectedRows + " record(s) updated"); }); }); Index.js
  • 12. Node.js MySQL Select From: var mysql = require('mysql'); var con = mysql.createConnection({ host: "localhost", user: "yourusername", password: "yourpassword", database: "mydb" }); con.connect(function(err) { if (err) throw err; con.query("SELECT * FROM customers", function (err, result, fields) { if (err) throw err; console.log(result); }); }); Index.js
  • 13. Node.js MySQL Where: var mysql = require('mysql'); var con = mysql.createConnection({ host: "localhost", user: "yourusername", password: "yourpassword", database: "mydb" }); con.connect(function(err) { if (err) throw err; con.query("SELECT * FROM customers WHERE address = 'Park Lane 38'", function (err, result) { if (err) throw err; console.log(result); }); }); Index.js
  • 14. Node.js MySQL Order By: var mysql = require('mysql'); var con = mysql.createConnection({ host: "localhost", user: "yourusername", password: "yourpassword", database: "mydb" }); con.connect(function(err) { if (err) throw err; con.query("SELECT * FROM customers ORDER BY name", function (err, result) { if (err) throw err; console.log(result); }); }); Index.js
  • 15. Node.js MySQL Delete: var mysql = require('mysql'); var con = mysql.createConnection({ host: "localhost", user: "yourusername", password: "yourpassword", database: "mydb" }); con.connect(function(err) { if (err) throw err; var sql = "DELETE FROM customers WHERE address = 'Mountain 21'"; con.query(sql, function (err, result) { if (err) throw err; console.log("Number of records deleted: " + result.affectedRows); }); }); Index.js
  • 16. Node.js MySQL Drop Table: var mysql = require('mysql'); var con = mysql.createConnection({ host: "localhost", user: "yourusername", password: "yourpassword", database: "mydb" }); con.connect(function(err) { if (err) throw err; var sql = "DROP TABLE customers"; con.query(sql, function (err, result) { if (err) throw err; console.log("Table deleted"); }); }); Index.js
  • 17. Model Questions: 1. HTML (Hyper Text Markup Language) has language elements, which permit certain actions other than describing the structure of the Web document. Which one of the following actions is NOT supported by pure HTML (without any server or client-side scripting) pages? (a) Embed Web objects from different sites into the same page (b) Refresh the page automatically after a specified interval. (c) Automatically redirect to another page upon download. (d) Display the client time as part of the page. (GATE 2011: 1 Mark) Solution: <OBJECT> … </OBJECT> tag is used to embed web objects. <META HTTP-EQUIV="Refresh" CONTENT="5"> is used to refresh page after every 5 seconds. <META HTTP-EQUIV="Refresh" CONTENT="0; URL=another-page.html"> is used to redirect. But for displaying the client time, there is no tag available.
  • 18. Model Questions: (Cont.) 2. To change the text colour in HTML we use? (a) Color: (b) latest—text—color= (c) modifytextcolor: (d) newcolor: 3. Which of the following is used to specify border type (solid or dotted or double line etc.)? (a) Border-width (b) Border-attrib (c) Border-style (d) Border-layout