Vik (Vik v0.0.1-rc1)

View Source

The public API all Shards have access to; imported by default.

Summary

Functions

Can be used to make modules available to other shards using include/1.

Exposes the given function or module as a publicly accessible API endpoint.

Can be used to automatically alias modules defined by another shard in the current shard.

Types

export()

@type export() :: module() | {module(), atom(), arity()}

slug()

@type slug() :: String.t()

Functions

export(module)

(macro)

Can be used to make modules available to other shards using include/1.

Examples

defmodule Hello do
  def world do
    "hewwo world :3"
  end
end

export Hello

expose(spec)

(macro)

Exposes the given function or module as a publicly accessible API endpoint.

Examples

def call(conn, []) do
  send_resp(conn, 200, "hewwo world :3")
end

expose call: 2


def call(conn, ~m{name}s, []) do
  send_resp(conn, 200, "hewwo, #{name}!)
end

expose call: 3

include(slug)

(macro)

Can be used to automatically alias modules defined by another shard in the current shard.

The other module will be compiled before the calling module. Cyclic dependencies will crash the system. So maybe don't do that? thx :)

Examples

include "foo"
Foo.bar()