Giter VIP home page Giter VIP logo

elm-http-server's Introduction

Elm Http Server

Simple bindings to Node.js's Http.Server as a Signal (Request, Response). IO is handled through Tasks.

Ideally this serves as a starting point for low level bindings, and will expand to have exhaustive bindings to Http.Server, and be the basis for other libraries such as routing.

Get started

To get your server running, you must execute your Tasks with ports. As well as start Elm inside the Node process. To start Elm inside of Node simply this to the end of your compiled Elm code.

Elm.worker(Elm.main);

Take a look at example/run.sh to see a complete usage

elm make example/Main.elm --output=example/main.js
echo "Elm.worker(Elm.Main);" >> example/main.js
node example/main.js

Run the example

This project depends on Node.js and the node command.

sh example/run.sh

Test a POST request

curl --data "" localhost:8080/json

Contribute

Found a bug? Want to add a feature?

Native glue from JavaScript to Elm is in wisp. Wisp is

Homoiconic JS with Clojure syntax, s-expressions & macros.

Basically ClojureScript lite.

The wisp wrapper can be found here.

Building

First get the latest Chartjs* run

sh update-from-bower.sh

Then you can build the artifact

sh make.sh

Check work in the reactor like normal.


Side Note

Some of the Standard Libraries in Elm make use of the window global in the browser. Obviously this breaks Node.js at runtime. To alleviate the problem, this package null checks window and binds it to global. Sorry if that breaks your code or causes things to be confusing.

(if (== (typeof window) :undefined) (set! window global))

elm-http-server's People

Watchers

Matthew Berry 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.