Code Monkey home page Code Monkey logo

elixir_sample's Introduction

ElixirExample

The purpose of this code is to provide materials for training other engineers in the concepts of Erlang, OTP, and Elixir.

Editing

Starting

To start your new Phoenix application:

  1. Install dependencies with mix deps.get
  2. Start Phoenix router with mix phoenix.start

Now you can visit localhost:4000 from your browser.

Description

Visiting "/" will pass whatever get params to the InputServer

IE:

http://localhost:4000/?doc[id]=1&doc[name]=purchase_order

'ExampleApplication' is a dependency of ElixirExapmle it is an instance of an Erlang VM application written in Elixir.

ExampleApplication has 2 GenServers and a GenEvent Handler to use as training materials.

example_application/mix.exs configures erlang vm environment variables for a server 'localhost' running on port 9292. This server is a mock external dependency. It echo's any params or body posted to it and returns json content-type response with a 200 status code.

The mock external dependency is started from ./example_application via 'rackup'.

eg:

cd ./example_application
rackup

With a http request :

GET http://u2u.local:4000/?invoice[id]=123&invoice[item]=414

The phoenix application 'ElixirSample' will call the 'ExampleApplication' InputServer with any passed get parameters as a map (dictionary). (ASYNC)

The InputServer will in mark the map with 'processed' and generate an event processed_input with the document. (ASYNC)

The Event Handler will generate another call to OutputServer to dispatch the result to the external service. (ASYNC)

The GenServer InputServer and OutputServer are written async (handle_cast) and could optionally be written syncronously 'handle_call'.

elixir_sample's People

Contributors

robotarmy avatar curtislinden avatar

Stargazers

 avatar

Watchers

James Cloos 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.