Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kumari858 committed Nov 1, 2020
0 parents commit 344126e
Show file tree
Hide file tree
Showing 1,968 changed files with 264,167 additions and 0 deletions.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node app.js
64 changes: 64 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const express = require("express");
const bodyParser = require("body-parser");
const request = require("request");
const https = require("https");
const app = express();
app.use(express.static("public"));
app.use(bodyParser.urlencoded({extended:true}));


app.get("/", function(req, res){
res.sendFile(__dirname +"/signup.html");
});
app.post("/", function(req, res){
const firstName= req.body.fname;
const lastName = req.body.lname;
const email= req.body.email;
const data = {
members :[
{
email_address : email,
status : "subscribed",
merge_fields:{
FNAME: firstName,
LNAME: lastName
}
}
]

};
const jsonData = JSON.stringify(data);

const url ="https://us2.api.mailchimp.com/3.0/lists/96eeb38fb2";
const options = {
method: "POST",
auth: "pink:d12fae43b884917722cc86772a0cc51e-us2"
}
const request = https.request(url, options, function(response){
if(response.statusCode===200){
res.sendFile(__dirname + "/success.html");

}
else{
res.sendFile(__dirname +"/failure.html");
}
response.on("data",function(data){
console.log(JSON.parse(data));
})
})
request.write(jsonData);
request.end();
//console.log(firstName,lastName,email);
});


app.post("/failure",function(req,res){
res.redirect("/")
});
app.listen (process.env.PORT||3002, function(){
console.log("server running..");
});
//list id
//96eeb38fb2
//api key
//d12fae43b884917722cc86772a0cc51e-us2
22 changes: 22 additions & 0 deletions failure.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>failure</title>

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
</head>
<body>
<div class="jumbotron jumbotron-fluid">
<div class="container">
<h1 class="display-4">uh oh!</h1>
<p class="lead">There is problem in signing you up. Please try again !</p>
<form action="/failure" method="post">
<button class="btn btn-lg btn-warning" type="submit"name="button">Try Again</button>

</form>
</div>
</div>
</body>
</html>
15 changes: 15 additions & 0 deletions node_modules/.bin/_nodeman

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/_nodeman.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions node_modules/.bin/_nodeman.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions node_modules/.bin/is-ci

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/is-ci.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions node_modules/.bin/is-ci.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions node_modules/.bin/mime

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/mime.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions node_modules/.bin/mime.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions node_modules/.bin/nodeman

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/nodeman.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions node_modules/.bin/nodeman.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions node_modules/.bin/nodemon

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/nodemon.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions node_modules/.bin/nodemon.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions node_modules/.bin/nodetouch

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/nodetouch.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 344126e

Please sign in to comment.