Create Phoenix based application without database but with Ecto

I have just started my adventure with Phoenix and Elixir but I would like to build REST API application.
I would like to use those really nice Ecto features but I don’t need database. I am about to connect this application to one another which will be the worker and will keep my resources.

I have tried mix phoenix.new --no-ecto - I haven’t had database connected but run into some undefined functions after I have used mix phoenix.create.json task. (schema/2).

I have tried to drop the repo with mix ecto.drop but still my application tries to connect to database and log file is just full of errors.

I have skipped ecto again and tried something simple but then I got some problems with render functions in my View module.

I would like my application to consume HTTP request and then send it to this other application (responsible for handling the resources) over some message bus.

Can someone please give me some advices?

2 Likes

Pardon my guesswork, here are some suggestions:

  • Try setting the pool_size to 0
  • Try removing supervisor(MyApp.Repo, []) from myapp.ex

If you want Ecto, --no-ecto won’t do. The solution is in simply disabling the connect features.

That should do it.

4 Likes

Thanks a lot I’ll try that soon.

When I tried --no-ecto I was following some tutorial found somewhere but then I read more about Ecto itself and Ecto used in Phoenix and I learned quite quickly that this would not be the option for me.

I have fixed issues with the render functions so now I can continue.

FYI - Mazyod’s instructions are still valid, have it working for PHX v 1.4.6 with live view.

  • Try setting the pool_size to 0
  • Try removing supervisor(MyApp.Repo, []) from myapp.ex
1 Like

In case anyone need this info in 2019 :slight_smile:

Inside
/lib/app_name/application.ex

Comment out line next to # Start the Ecto repository
AppName.Repo <-- this you need to comment out

1 Like