Create Your Repo Module
Learn how to create the repository module for your app.
Next, we need to create our application’s repository module. We went through this process in detail before, but we’ll run through it again here.
Creating repo.ex
file
Open a new file called lib/my_app/repo.ex
and add the following:
Press + to interact
defmodule MyApp.Repo douse Ecto.Repo,otp_app: :my_app,adapter: Ecto.Adapters.Postgresend
Explanation
The use Ecto.Repo
directive will make our module a bona fide Ecto repository—all of Ecto’s repository functions will be defined and made available on this module. For more details on how this works, see ...