sample - example app

221V 68f30674ac deps - erl25 1 год назад
apps 9252cb2421 deps -- erl24, cowboy2 1 год назад
.gitignore 48ed6aa89e add example -- postgresql queries without pool, erl19 fix warnings 1 год назад
Makefile 48ed6aa89e add example -- postgresql queries without pool, erl19 fix warnings 1 год назад
README.md cf58008919 upd readme -- install 1 год назад
mad ee9d6586ba erl23 deps 1 год назад
otp.mk 9252cb2421 deps -- erl24, cowboy2 1 год назад
rebar.config 68f30674ac deps - erl25 1 год назад
sys.config caa594ac60 add postgresql queries with pool 1 год назад
test_pg.sql 48ed6aa89e add example -- postgresql queries without pool, erl19 fix warnings 1 год назад
vm.args 48ed6aa89e add example -- postgresql queries without pool, erl19 fix warnings 1 год назад
xen.config f56791f2c9 init original n2o v4.4 1 год назад

README.md

N2O: Erlang Web Framework on WebSockets

ScreenShot

Samples

Samples provided as Erlang release packaged with web Erlang application which contains modules:

  • REST samples
  • N2O samples
  • XEN support

Install

Erlang with kerl or erlang-solutions
or from official website

sudo apt-get install esl-erlang

sudo apt-get install git
sudo apt-get install gcc
sudo apt-get install make
sudo apt-get install build-essential
sudo apt-get install inotify-tools

Run

$ make
$ make start
$ make attach
CTRL + D

To run just perform on Windows, Linux and Mac

$ ./mad deps compile plan repl

On BSD you should use gmake

And open it in browser http://localhost:8000 If you want to try pure Single Page Application (SPA) wich connects to Erlang N2O Application Server you should use http://localhost:8000/static/spa/spa.htm

For full features of make please refer to https://github.com/synrc/otp.mk

Production Assets

$ ./mad static min
> application:set_env(n2o,mode,prod).

Xen

To run on Xen is a bit tricky:

$ sudo apt-get install xen-hypervisor-amd64
$ echo XENTOOLSTACK=xl > /etc/default/xen

Boot into Xen 4.2 Domain-0 and create network bridge:

$ sudo brctl addbr docker0
$ sudo ip addr add 172.16.42.1/24 dev docker0

Compile Image at Erlang on Xen builder:

$ rebar get-deps compile
$ ./nitrogen_static.sh
$ rebar ling-build-image
$ sudo xl create -c xen.config

Inside Ling start n2o_sample application:

Ling 0.2.2 is here
Started in 49438 us
Erlang [ling-0.2.2]

Eshell V5.10.2  (abort with ^G)
1> application:start(n2o_sample).

And open it in browser http://172.16.42.108:8000

Credits

  • Maxim Sokhatsky

OM A HUM