CC Practical - Shridhar
CC Practical - Shridhar
INDEX
1
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
PRACTICAL: 1
2
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
OUTPUT:
3
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
PRACTICAL: 2
4
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
http://localhost:3300/sub/2/3
http://localhost:3300/mult/2/3
http://localhost:3300/div/2/3
5
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
OUTPUT:
6
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
PRACTICAL: 3
7
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
if (!item) {
res.status(404).json({ error: 'Item not found' });
} else {
res.json(item);
}
});
// Server isstaaaarrrttt :)
app.listen(PORT, () => {
console.log(Server is running on port ${PORT});
});
Output:
8
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
9
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
PRACTICAL: 4
import requests
def get_geolocation(api_key, search_string):
base_url = "https://us1.locationiq.com/v1/search"
params = {
'key': api_key,
'q': search_string,
'format': 'json',
}
response = requests.get(base_url, params=params)
data = response.json()
10
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
11
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
PRACTICAL: 5
OUTPUT:
12
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
PRACTICAL: 6
Aim: Develop Application to download image/video from server or upload image/video to server
using MTOM techniques
(node.js) Code:
const express = require('express');
const multer = require('multer');
const path = require('path');
const fs = require('fs');
const app = express();
const port = 3000;
// Define storage using multer.diskStorage
const storage = multer.diskStorage({
destination: (req, file, cb) => {
// Set the destination folder where the file will be saved
const uploadFolder = 'uploads';
fs.mkdirSync(uploadFolder, { recursive: true });
cb(null, uploadFolder);
},
filename: (req, file, cb) => {
// Set the filename to the original filename
cb(null, file.originalname);
},
});
const upload = multer({ storage: storage });
app.post('/upload', upload.single('file'), (req, res) => {
const file = req.file;
// Check if file is present
13
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
if (!file) {
return res.status(400).json({ success: false, message: 'No file uploaded.' });
}
// Process the file as needed (save to disk, database, etc.)
res.json({ success: true, message: 'File uploaded successfully.' });
});
app.get('/download/:filename', (req, res) => {
const filename = req.params.filename;
const filePath = path.join(__dirname, 'uploads', filename);
// Check if file exists
if (fs.existsSync(filePath)) {
// Implement logic to send the file as a response
res.sendFile(filePath);
} else {
res.status(404).json({ success: false, message: 'File not found.' });
}
});
app.listen(port, () => {
console.log(Server is running on http://localhost:${port});
});
RUN THE CODE: IT WILL START THE SERVER AT localhost:3000
14
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
THEN CLICK ON BODY>FORM DATA>NAME THE KEY ITEM AND FILE TYPE: FILE
IN VALUE TAB ENTER THE FILE YOU WANT TO UPLOAD TO THE SERVER
CLICK ON SEND
15
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
Upload Output:
DOWNLOAD:
16
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
CLICK ON SUBMIT
DOWNLOAD OUTPUT :
17
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
PRACTICAL: 7
Aim: Cloud Functionality VSI (Virtual Server Infrastructure) Infrastructure as a Service (IaaS),
Storage
18
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
THE FIRST SCREEN AFTER LOGIN SHOWS MANY OPTIONS TO INSTALL AND
DEPLOY ANY VIRTUAL MACHINE. TO INSTALL A VIRTUAL MACHINE CLICK
ON VIRTUAI MACHINE-> UPLOAD ISO FILE OPTION AND UPLOAD THE
BOOTABLE ISO FILE. HERE, WE ARE GOING TO UPLOAD LINUX ELEMENTARY
0S IS0.
20
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
VIEW MACHINE. WHEN YOU CLICK ON IT, THE BROWSER WILL POP-UP FOR
LAUNCHING THE APPLICATION.
IF THE APPLICATION DOES NOT LAUNCH AUTOMATICALLY, LAUNCH IT
MANUALLY BY ENTERING THE LINK AND PASSWORD IN THE REMOTE VIEWER
TOOL WHICH YOU WILL SEE IN THE POP-UP MESSAGE.
ONCE IT CONNECTS, ENTER THE PASSWORD WHICH WAS GIVEN IN THE LINK
AND CLICK OK.
FINALLY YOU WILL ABLE TO VIEW AND CONTROL YOUR VIRTUAL MACHINE.
21
TY.BSC.CS CLOUD COMPUTING & WEB SERVICES 1109238
22