An example demonstrating how to use Horizon in Elm 0.17 using ports.
Install the following software:
Then run:
npm install
hz init
npm start
Horizon chat example ported to Elm
License: MIT License
Hi. I am really excited about Elm and Horizon and wanted to try this out. I am having some issues and was curious if you could add a few extra details on the steps to get this started.
The steps that I followed were:
The app itself runs. I get to Horizon ready for connections in terminal. But I get the error: "unexpected token e in JSON at position 0" and Chrome shows a blank screen in the browser.
I think for total beginners, adding something about needing to run hz init to get a .hz file would be helpful and I am curious if you have seen this error before.
Elm: 0.17, Rethink 3.2.1, Node 4.4.
Thank you again for doing this!
The most likely cause is: this directory doesn't contain an .hz directory
Full output (starting from a freshly cloned repo):
MacBook-Pro:horizon-elm-chat-app thsoft$ npm install
npm WARN package.json [email protected] No repository field.
MacBook-Pro:horizon-elm-chat-app thsoft$ npm start
> [email protected] prestart /Users/thsoft/Development/horizon-elm-chat-app
> npm run build
> [email protected] build /Users/thsoft/Development/horizon-elm-chat-app
> elm make src/Chat.elm --output dist/app.js
Success! Compiled 1 module.
Successfully generated dist/app.js
> [email protected] start /Users/thsoft/Development/horizon-elm-chat-app
> hz serve --dev --allow-anonymous yes
this directory doesn't contain an .hz directory
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.4.7
npm ERR! npm v2.15.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `hz serve --dev --allow-anonymous yes`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'hz serve --dev --allow-anonymous yes'.
npm ERR! This is most likely a problem with the horizon-chat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! hz serve --dev --allow-anonymous yes
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs horizon-chat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls horizon-chat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/thsoft/Development/horizon-elm-chat-app/npm-debug.log
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.