Advanced Web Application Lab Programs
Advanced Web Application Lab Programs
1. Create Node .JS application to display some message by using Client Server model
1. Methodology
Import required modules: The "require" directive is used to load a Node.js
module.
Create server: You have to establish a server which will listen to client's request
similar to Apache HTTP Server.
Read request and return response: Server created in the second step will read
HTTP request made by client which can be a browser or console and return the
response.
2. Process Steps/Description
A node.js web application contains the following steps
Open Node.js command prompt and run the following code:
node console_example1.js
2. Create server: In the second step, you have to use created http instance and
call http.createServer() method to create server instance and then bind it at
port 8081 using listen method associated with server instance. Pass it a
function with request and response parameters and write the sample
implementation to return "Hello World". For example:
6. Result/inference:
Thus the create a simple NodeJS and running it in VS Code editor and
the simple node is created with server and the output is verified.
1. Process Steps/Description
Step 1: Create an empty folder and move it into that folder from your VS Code
editor, use the following command.
mkdir demo
cd demo
Step 1: Create an empty folder and move it into that folder from your VS Code
editor, use the following command.
mkdir demo
cd demo
code .
Step 3: Now create a file app.js file in your folder as shown below.
5.Sample Input/Output:
Open http://127.0.0.1:8000/ in browser to see the result.
6. Result/inference:
Thus the create a simple Express.JS and running it in VS Code editor and
the simple node is created with server and the output is verified.
3. Write MONGO shell basic commands and execute with proper output.
2,Process Steps/Description
Basic Commands
Show current
db db
database
Display help on DB
db.help() db.help()
methods
Show all
show
collections in show collections
collections
current database
4. Sample Input/Output:
Run the following command to get sample output
>db
>show dbs
>help
4. Result/inference:
Thus the above commands are executed and the output is verified
.
4. Write MONGO CRUD OPERATIONS and execute with proper output.
The following operations are used to create (C), read (R), update (U),
and delete (D) a document in MONGODB. These operations are
often referred to as CRUD operations.
2,Process Steps/Description
Create operation – Create operation or Insert operation are used to add new
documents to the collection and if the collection does not exist, it creates one.
Read operation – This operation reads the documents from the collection. This
process is taken place by executing a query.
Delete operation – Delete operation erases the document from the collection.
3.Methodology
The following operations are used to create (C), read (R), update (U),
and delete (D) a document in MONGODB
5. Sample Input/Output:
Create operations add new documents to a collection.
db.collection.insertOne()
db.collection.insertMany()
db.cars.insertOne(
//insert Civic 2017 into cars
{
name: "Civic"
model: "2017"
}
)
Read
Read operations retrieve documents from a collection. If there is no
collection that currently exists, it will automatically create a new one.
db.collection.find()
Here is an example of how a car can be found from the cars collection:
db.cars.find(
//find the 2017 models
{ model: "2017"}
)
Update
Update operations modify documents from a collection.
db.collection.updateOne()
db.collection.updateMany()
db.collection.replaceOne()
Delete
Delete operations delete documents from a collection.
db.collection.deleteOne()
db.collection.deleteMany()
Here is an example of how a car can be deleted from the cars collection:
db.cars.updateMany(
//delete all cars from 2017
{ name: "Civic" }
)
5. Result/inference:
Thus the above commands are executed and the output is verified
i.BCA
ii.BCA
III. MCA
IV. BBA
V.MBA
VI.M.Com
SAMPLE CODE
<!DOCTYPE html>
<html>
<head>
<script src="C:\angular-1.8.0\angular-1.8.0\angular.js"></script>
<style>
div {
width: 100%;
height: 100px;
display: block;
margin-bottom: 10px;
text-align:left;
background-color:yellow;
</style>
</head>
<ol type=i>
{{name}}
</li>
</ol>
<ol type=i>
{{name}}
</li>
</ol>
</div>
</body></html>