Code Monkey home page Code Monkey logo

jspubsub's Introduction

JavaScript Services Event Stream Example

Simple example of using event-based collaboration between two web services: the cuwtomer and email services. The services are built using Node Express, and use PubNub, a JavaScript event stream based on WebSockets.

##Customer Service

###To run the customer service:

    git clone https://github.com/jdamore/jspubsub
    cd customer-service
    sudo npm install
    node service
    http://localhost:3000

###Customer service API

- Add a customer: 			POST http://localhost:3000/ {name:{customer_name}, email:{customer_email}}
- Select all customers: 	GET http://localhost:3000/
- Select one customer: 		GET http://localhost:3000/{customer_name}

Email Service

###To run the email service:

    git clone https://github.com/jdamore/jspubsub
    cd email-service
    sudo npm install
    node service
    http://localhost:3001

###Email service API

- Select all emails: 	GET http://localhost:3001/
- Select one email: 	GET http://localhost:3001/{email}

##Test the integration Run the add_customer.sh script. It will POST a new customer to the customer service, and check an welcome email has automatically been sent, because the customer_created event has been published.

jspubsub's People

Contributors

jeandamore avatar

Watchers

James Cloos avatar 林旭 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.