The basic project based on API using node.js and deploy it to heroku
Making GET Requests with the Node HTTPS Module
Parse JSON
Using Express to Render a Website with Live API Data
Using Body Parser to Parse POST Requests to the Server
Setting Up the Sign Up Page (signup.html)
Adding Success(success.html) and Failure Pages (failure.html)
After deploying our project at heroku the link is generated my project link is
Go to given heroku link to view my work
Use the package manager npm to install express, body-parser, request.
npm install express
const express = require("express");
const request = require("request");
const bodyParser = require("body-parser");
const app = express();
app.use(express.static("public"));
app.use(bodyParser.urlencoded({extended:true}));
run the server using command in cmd where these files are created
$ node app.js
server is running on port localhost:3000
app.listen(process.env.PORT || 3000,function(){
console.log("server is running at 3000...");
});
at localhost:3000 signup.html loads
On this page we enter our first name , last name and email and then signup
var data = {
members: [
{
email_address: email,
status:"subscribed",
merge_fields: {
FNAME:firstname,
LNAME:lastname
}
}
]
};
var option = {
url:"https://us2.api.mailchimp.com/3.0/lists/6f7021edb7",
method:"POST",
headers: {
"Authorization":"himanshu1 e29a37208fc6749cebdc794848960e51-us2"
},
body: jsondata
}
API key an Authorization key from mailchimp
LIST it is SSH key of heroku
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.