Merge 8187c20647
into 08b771c863
commit
44243aeba2
@ -0,0 +1,186 @@
|
|||||||
|
<!-- api.openweathermap.org/data/2.5/weather?q=Nilphamari&appid=a5465519d4019d2c4500a735997c7daa -->
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css"
|
||||||
|
integrity="sha512-BnbUDfEUfV0Slx6TunuB042k9tuKe3xrD6q4mg5Ed72LTgzDIcLPxg6yI2gcMFRyomt+yJJxE+zJwNmxki6/RA=="
|
||||||
|
crossorigin="anonymous"
|
||||||
|
referrerpolicy="no-referrer"
|
||||||
|
/>
|
||||||
|
<!-- i tried to connect with the css file but couldn't that is why i used inline css -->
|
||||||
|
<!-- <link rel="stylesheet" href="home.css" /> -->
|
||||||
|
<style>
|
||||||
|
|
||||||
|
* {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
color: white;
|
||||||
|
/*background-color: #1b3bf5; */
|
||||||
|
|
||||||
|
/*background: aqua; */
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
height: 300vh;
|
||||||
|
width: 100vw;
|
||||||
|
background-color: skyblue;
|
||||||
|
padding-top: 12%;
|
||||||
|
position: fixed;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.box {
|
||||||
|
padding: 1%;
|
||||||
|
width: 30%;
|
||||||
|
|
||||||
|
margin: auto;
|
||||||
|
background: blueviolet;
|
||||||
|
border-radius: 10px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#weathercon {
|
||||||
|
text-align: center;
|
||||||
|
background-color: #82ade4;
|
||||||
|
size: 50px;
|
||||||
|
}
|
||||||
|
#weathercon.fas fa-sun icon{
|
||||||
|
font-size: 6rem;
|
||||||
|
animation: fas-anime 3s linear infinite alternate;
|
||||||
|
}
|
||||||
|
@keyframes fas-anime{
|
||||||
|
from{
|
||||||
|
transform: scale(0.8);
|
||||||
|
}
|
||||||
|
to{
|
||||||
|
transform: scale(1.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
text-align: center;
|
||||||
|
background-color: hsl(214, 87%, 69%);
|
||||||
|
}
|
||||||
|
.temp {
|
||||||
|
background-color: #07197c;
|
||||||
|
padding: 5%;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin: 10px auto 10px;
|
||||||
|
}
|
||||||
|
.icon_status {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
h1,
|
||||||
|
p {
|
||||||
|
margin: 5px auto 5px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.icon{
|
||||||
|
font-size: 50px;
|
||||||
|
}
|
||||||
|
.fa-street-view{
|
||||||
|
animation: rotates 3s linear infinite alternate;
|
||||||
|
size-adjust: 100px;
|
||||||
|
}
|
||||||
|
@keyframes rotates{
|
||||||
|
from{
|
||||||
|
transform: translateX(-0.5rem);
|
||||||
|
}
|
||||||
|
to{
|
||||||
|
transform: translateX(0.5rem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<title>Current Weather</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h1 style="color: black; ">WELCOME TO JHANSI WEATHER WEBSITE</h1>
|
||||||
|
<div class="box">
|
||||||
|
<div class="wave -one"></div>
|
||||||
|
<div class="wave -two"></div>
|
||||||
|
<div class="wave -three"></div>
|
||||||
|
<div id="icon_status1"class="icon_status">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div id="weathercon">
|
||||||
|
<i class="fas fa-sun icon" style="color: #f5ed50"></i>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="info">
|
||||||
|
<h2 class="location"></h2>
|
||||||
|
<i class="fas fa-street-view" style="color: #fff;"> {%location%} ,{% country %}</i>
|
||||||
|
<p id="date">21 july, 2021</p>
|
||||||
|
<h1 class="temp">{%tempval%}°C</h1>
|
||||||
|
<h3 class="temp_min_max">Min: {%tempmin%} | Max: {%tempmax%}</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p style="color: blueviolet;">Made With Core Node.js and made by-ADITI JAIN</p>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
const curDate=document.getElementById("date");
|
||||||
|
let weathercon=document.getElementById("weathercon");
|
||||||
|
const tempStatus="Clouds";
|
||||||
|
const getCurrentDay = () => {
|
||||||
|
let currentTime = new Date();
|
||||||
|
const day = new Array(7);
|
||||||
|
day[0] = "Sunday";
|
||||||
|
day[1] = "Monday";
|
||||||
|
day[2] = "Tuesday";
|
||||||
|
day[3] = "Wednesday";
|
||||||
|
day[4] = "Thursday";
|
||||||
|
day[5] = "Friday";
|
||||||
|
day[6] = "Saturday";
|
||||||
|
let days= day[currentTime.getDay()];
|
||||||
|
return days;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const getCurrentTime = () =>{
|
||||||
|
var months = [
|
||||||
|
"jan",
|
||||||
|
"Feb",
|
||||||
|
"Mar",
|
||||||
|
"April",
|
||||||
|
"May",
|
||||||
|
"June",
|
||||||
|
"July",
|
||||||
|
"August",
|
||||||
|
"September",
|
||||||
|
"October",
|
||||||
|
"November",
|
||||||
|
"December",
|
||||||
|
|
||||||
|
];
|
||||||
|
var now =new Date();
|
||||||
|
var month = months[now.getMonth()];
|
||||||
|
var date = now.getDate();
|
||||||
|
|
||||||
|
let hours=now.getHours();
|
||||||
|
let mins = now.getMinutes();
|
||||||
|
|
||||||
|
let period="AM";
|
||||||
|
if(hours>11){
|
||||||
|
period="PM";
|
||||||
|
if(hours>12) hours-=12;
|
||||||
|
}
|
||||||
|
if(mins<10){
|
||||||
|
mins="0"+mins;
|
||||||
|
}
|
||||||
|
return `${month} ${date} | ${hours}: ${mins}${period}`;
|
||||||
|
};
|
||||||
|
curDate.innerHTML= getCurrentDay()+ " | "+ getCurrentTime();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,46 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
const http = require("http");
|
||||||
|
const request = require("requests");
|
||||||
|
|
||||||
|
const homeFile = fs.readFileSync("home.html", "utf-8");
|
||||||
|
const replaceVal=(tempVal,orgVal)=>{
|
||||||
|
let temprature =tempVal.replace("{%tempval%}",(orgVal.main.temp-273).toFixed(2));
|
||||||
|
temprature =temprature.replace(" {%tempmin%}",(orgVal.main.temp_min-273).toFixed(2));
|
||||||
|
temprature =temprature.replace("{%tempmax%}",(orgVal.main.temp_max-273).toFixed(2));
|
||||||
|
temprature =temprature.replace("{%location%}",orgVal.name);
|
||||||
|
temprature =temprature.replace("{% country %}",orgVal.sys.country);
|
||||||
|
return temprature;
|
||||||
|
|
||||||
|
}
|
||||||
|
const server = http.createServer((req, res) => {
|
||||||
|
if(req.url="/"){
|
||||||
|
request(
|
||||||
|
"https://api.openweathermap.org/data/2.5/weather?q=jhansi&appid=57bccf5451bb6ba3d382c539623eac29"
|
||||||
|
)
|
||||||
|
|
||||||
|
.on("data",chunk=>{
|
||||||
|
const objdata=JSON.parse(chunk);
|
||||||
|
const arrData=[objdata];
|
||||||
|
//console.log(arrData[0].main.temp);
|
||||||
|
const realTimeData=arrData
|
||||||
|
.map((val)=> replaceVal(homeFile,val))
|
||||||
|
.join("");
|
||||||
|
|
||||||
|
res.write(realTimeData);
|
||||||
|
//console.log(realTimeData);
|
||||||
|
})
|
||||||
|
.on("end",err=>{
|
||||||
|
if(err)
|
||||||
|
return console.log("connection closed",err);
|
||||||
|
res.end();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
server.listen( 4000,"127.0.0.1",()=>{
|
||||||
|
console.log('listening to the port number 80')
|
||||||
|
});
|
||||||
|
// learning ssh set up from vinod bahadur thapa..thapa technical.... al mamun
|
||||||
|
|
||||||
|
|
@ -0,0 +1,168 @@
|
|||||||
|
{
|
||||||
|
"name": "thapa",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "thapa",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"requests": "^0.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/axo": {
|
||||||
|
"version": "0.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/axo/-/axo-0.0.2.tgz",
|
||||||
|
"integrity": "sha1-STVfu+qzhEm8ppahqsxGml7p/Uc="
|
||||||
|
},
|
||||||
|
"node_modules/eventemitter3": {
|
||||||
|
"version": "4.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
||||||
|
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
|
||||||
|
},
|
||||||
|
"node_modules/extendible": {
|
||||||
|
"version": "0.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/extendible/-/extendible-0.1.1.tgz",
|
||||||
|
"integrity": "sha1-4qN+2HEp+0+VM+io11BiMKU5yQU="
|
||||||
|
},
|
||||||
|
"node_modules/failure": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/failure/-/failure-1.1.1.tgz",
|
||||||
|
"integrity": "sha1-qOg9OxYC0kaL/2rU2QceAQO4Goc="
|
||||||
|
},
|
||||||
|
"node_modules/hang": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/hang/-/hang-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-ZwUIeYRENeAq4ECcT0VTxkOOHXE="
|
||||||
|
},
|
||||||
|
"node_modules/loads": {
|
||||||
|
"version": "0.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/loads/-/loads-0.0.4.tgz",
|
||||||
|
"integrity": "sha1-l/MBY5fnDd/0gLgexjjO6iKgqZw=",
|
||||||
|
"dependencies": {
|
||||||
|
"failure": "1.1.x",
|
||||||
|
"one-time": "0.0.x",
|
||||||
|
"xhr-response": "1.0.x",
|
||||||
|
"xhr-status": "1.0.x"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/node-http-xhr": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-http-xhr/-/node-http-xhr-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-0bA08/2RKWxw6pMkOVd3KP+0F5+ifQLMMTDxrCgxlgkoU1N8DhCbCSAYEqpgaVYM2smvbVVewiXjW+8AyoLfxQ=="
|
||||||
|
},
|
||||||
|
"node_modules/one-time": {
|
||||||
|
"version": "0.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/one-time/-/one-time-0.0.4.tgz",
|
||||||
|
"integrity": "sha1-+M33eISCb+Tf+T46nMN7HkSAdC4="
|
||||||
|
},
|
||||||
|
"node_modules/requests": {
|
||||||
|
"version": "0.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/requests/-/requests-0.3.0.tgz",
|
||||||
|
"integrity": "sha512-1B6nkiHjC1O1cSgFhEwkc+xd8vuj04h7xSmCg5yI8nmhCIKbPkX47od8erQ2pokBt5qxUO7dwP4jplXD6k6ISA==",
|
||||||
|
"dependencies": {
|
||||||
|
"axo": "0.0.x",
|
||||||
|
"eventemitter3": "~4.0.0",
|
||||||
|
"extendible": "0.1.x",
|
||||||
|
"hang": "1.0.x",
|
||||||
|
"loads": "0.0.x",
|
||||||
|
"node-http-xhr": "~1.3.0",
|
||||||
|
"xhr-send": "1.0.x"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/xhr-response": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/xhr-response/-/xhr-response-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-r/46CFRLpyGG5NxSzQImZx2Gc/4="
|
||||||
|
},
|
||||||
|
"node_modules/xhr-send": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/xhr-send/-/xhr-send-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-GkDHPl2yAo7gj+kPXD1tx/eWqFQ="
|
||||||
|
},
|
||||||
|
"node_modules/xhr-status": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/xhr-status/-/xhr-status-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-VF0WSqtmkf56OmF26LCWsWvRb1a+WYGdHDoQnPPCVUQTM8CVUAOBcUDsm7nP7SQcgEEdrvF4DmhEADuXdGieyw=="
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"axo": {
|
||||||
|
"version": "0.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/axo/-/axo-0.0.2.tgz",
|
||||||
|
"integrity": "sha1-STVfu+qzhEm8ppahqsxGml7p/Uc="
|
||||||
|
},
|
||||||
|
"eventemitter3": {
|
||||||
|
"version": "4.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
||||||
|
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
|
||||||
|
},
|
||||||
|
"extendible": {
|
||||||
|
"version": "0.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/extendible/-/extendible-0.1.1.tgz",
|
||||||
|
"integrity": "sha1-4qN+2HEp+0+VM+io11BiMKU5yQU="
|
||||||
|
},
|
||||||
|
"failure": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/failure/-/failure-1.1.1.tgz",
|
||||||
|
"integrity": "sha1-qOg9OxYC0kaL/2rU2QceAQO4Goc="
|
||||||
|
},
|
||||||
|
"hang": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/hang/-/hang-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-ZwUIeYRENeAq4ECcT0VTxkOOHXE="
|
||||||
|
},
|
||||||
|
"loads": {
|
||||||
|
"version": "0.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/loads/-/loads-0.0.4.tgz",
|
||||||
|
"integrity": "sha1-l/MBY5fnDd/0gLgexjjO6iKgqZw=",
|
||||||
|
"requires": {
|
||||||
|
"failure": "1.1.x",
|
||||||
|
"one-time": "0.0.x",
|
||||||
|
"xhr-response": "1.0.x",
|
||||||
|
"xhr-status": "1.0.x"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node-http-xhr": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-http-xhr/-/node-http-xhr-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-0bA08/2RKWxw6pMkOVd3KP+0F5+ifQLMMTDxrCgxlgkoU1N8DhCbCSAYEqpgaVYM2smvbVVewiXjW+8AyoLfxQ=="
|
||||||
|
},
|
||||||
|
"one-time": {
|
||||||
|
"version": "0.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/one-time/-/one-time-0.0.4.tgz",
|
||||||
|
"integrity": "sha1-+M33eISCb+Tf+T46nMN7HkSAdC4="
|
||||||
|
},
|
||||||
|
"requests": {
|
||||||
|
"version": "0.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/requests/-/requests-0.3.0.tgz",
|
||||||
|
"integrity": "sha512-1B6nkiHjC1O1cSgFhEwkc+xd8vuj04h7xSmCg5yI8nmhCIKbPkX47od8erQ2pokBt5qxUO7dwP4jplXD6k6ISA==",
|
||||||
|
"requires": {
|
||||||
|
"axo": "0.0.x",
|
||||||
|
"eventemitter3": "~4.0.0",
|
||||||
|
"extendible": "0.1.x",
|
||||||
|
"hang": "1.0.x",
|
||||||
|
"loads": "0.0.x",
|
||||||
|
"node-http-xhr": "~1.3.0",
|
||||||
|
"xhr-send": "1.0.x"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xhr-response": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/xhr-response/-/xhr-response-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-r/46CFRLpyGG5NxSzQImZx2Gc/4="
|
||||||
|
},
|
||||||
|
"xhr-send": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/xhr-send/-/xhr-send-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-GkDHPl2yAo7gj+kPXD1tx/eWqFQ="
|
||||||
|
},
|
||||||
|
"xhr-status": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/xhr-status/-/xhr-status-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-VF0WSqtmkf56OmF26LCWsWvRb1a+WYGdHDoQnPPCVUQTM8CVUAOBcUDsm7nP7SQcgEEdrvF4DmhEADuXdGieyw=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "thapa",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"requests": "^0.3.0"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue