Skip to content

The basic project based on API of mailchimp using node.js and deploy it to heroku

Notifications You must be signed in to change notification settings

himanshu03jain/Newsletter

Repository files navigation

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

The Mailchimp API

Setting Up the Sign Up Page (signup.html)

Posting Data to Mailchimp's Servers via their API

Adding Success(success.html) and Failure Pages (failure.html)

Deploying Server with Heroku

After deploying our project at heroku the link is generated my project link is

Go to given heroku link to view my work

https://mysterious-falls-06653.herokuapp.com/

Installation

Use the package manager npm to install express, body-parser, request.

npm install express 

Usage

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}));

Working

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

data json and option json

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

API keys mailchimp

LIST it is SSH key of heroku

Heroku CLI Authentication

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

About

The basic project based on API of mailchimp using node.js and deploy it to heroku

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published