Skip to content

Commit

Permalink
nitro sample
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT committed Jan 29, 2024
1 parent d59a3c3 commit b74418d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 21 deletions.
18 changes: 8 additions & 10 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import Config

config :n2o,
routes: UP.Route,
pickler: :n2o_secret,
app: :up,
points:
[{:_, [],
[{["n2o", :"..."], [], :cowboy_static, {:dir, 'deps/n2o/priv', [{:mimetypes, :cow_mimetypes, :all}]}},
{["app", :"..."], [], :cowboy_static, {:dir, 'priv', [{:mimetypes, :cow_mimetypes, :all}]}},
{["ws", :"..."], [], :n2o_cowboy, []} ]}],
mq: :n2o_syn,
rest: 5010,
ws: 5011,
tables: [:cookies, :file, :caching, :async],
protocols: [:n2o_heart, :nitro_n2o, :n2o_ftp],
routes: UP.Route
points:
[{:_, [],
[{["app", :"..."], [], :cowboy_static, {:dir, 'priv', [{:mimetypes, :cow_mimetypes, :all}]}},
{["ws", :"..."], [], :n2o_cowboy, []}]}]

config :kvs,
dba: :kvs_rocks,
dba_st: :kvs_st,
schema: [:kvs, :kvs_stream, :bpe_metainfo, MED]
dba: :kvs_mnesia,
dba_st: :kvs_stream,
schema: [:kvs, :kvs_stream]
6 changes: 2 additions & 4 deletions lib/up_nitro.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
defmodule UP.NITRO do
def event(:init) do
:io.format 'NITRO'
end
def event(_), do: []
def event(:init), do: :io.format 'NITRO INIT~n'
def event(x), do: :io.format 'MESSAGE ~p~n', [x] # > direct(tuple(atom('ok'),number(2)))
end

8 changes: 1 addition & 7 deletions lib/up_route.ex
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
defmodule UP.Route do
require N2O
require Logger

def finish(state, ctx), do: {:ok, state, ctx}
def init(state, context) do
%{path: path} = N2O.cx(context, :req)
{:ok, state, N2O.cx(context, path: path, module: ws(path))}
{:ok, state, N2O.cx(context, path: path, module: UP.NITRO)}
end

def ws(_), do: UP.NITRO
def route(_), do: UP.NITRO

end

0 comments on commit b74418d

Please sign in to comment.