Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<html>

<head>
<title>
Signup Form
</title>
</head>

<body>
<form action="http://127.0.0.1:8080/signup" method="GET">
Enter Username<input type="text" name="username"><br>
Enter Password<input type="password" name="password"><br>
<button type="submit">signup</button>
</form>
</body>

</html>
45 changes: 45 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const http = require('http');
const url = require('url');
const hostname="127.0.0.1";
const port =8080;
const express=require('express');
const server=http.createServer(function(req,res){
var q=url.parse(req.url,true).query;
console.log("DATA",q);
res.writeHead(200,{"Content-Type":"text/html"});
if(q['username']!=''){
console.log("enter IF");
res.write("<html>");
res.write("<!DOCTYPE html>");
res.write("<head>");
res.write("<title>");res.write("</title>");
res.write("</head>");
res.write("<body onload='myFunction()'>");
res.write("<script>")
res.write("function myFunction() {");
res.write("alert('"+q['username']+"');}");
res.write("</script>");

res.write("</body>");
res.write("</html>");
}
else{
console.log("enter else");
res.write("<!DOCTYPE html>");
res.write("<head>");
res.write("<title>");res.write("</title>");
res.write("</head>");
res.write("<body onload='myFunction()'>");
res.write("<script>")
res.write("function myFunction() {");
res.write("alert('Please Provide Valid Username');}");
res.write("</script>");
res.write("</body>");
res.write("</html>");
}

res.end();
});
server.listen(port,hostname,function(){
console.log("server started on "+hostname+":"+port);
});
Empty file removed readme.txt
Empty file.