Skip to content

Instantly share code, notes, and snippets.

View joaomilho's full-sized avatar
🐫

Yo Lulkin joaomilho

🐫
  • Personio.de
  • Berlin, Germany
View GitHub Profile
-module(petster_hello_controller, [Request]).
-compile(export_all).
world('GET', []) ->
{output, "This is not a hello world"}.
./init-dev.sh
{db_host, "localhost"},
{db_port, 5432},
{db_adapter, pgsql},
{db_username, "petster"},
{db_database, "petster_dev"},
boss_migrate:make(petster, pets).
%% Migration: pets
{pets,
fun(up) –> undefined;
(down) –> undefined
end}.
%% Migration: pets
UpSQL = "
CREATE TABLE pets(
id serial unique,
name text not null,
species text not null
);
".
boss_migrate:run(petster).
–module(pet, [Id, Name, Species]).
–compile(export_all).
–module(petster_pet_controller, [Request]).
–compile(export_all).
index('GET', []) –>
Pets = boss_db:find(pet, []),
{ok, [{pets, Pets}]}.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Petster</title>
</head>
<body>
{% block content %}{% endblock %}
</body>
</html>