0
votes

I'm having a problem with my re-frame application. I can't figure out how to connect it to a local database on my machine.

In other applications I've written, I've had to add the database specifications (username, password etc) into profiles.clj. Should I create profiles.clj and add the location of my database there? And does this mean I have to update the project.clj as well?

Finally, do the queries to the database, such as GET and POST requests, go in db.cljs.

I apologise if these questions are trivial but after reading the documentation several times I am still a little confused

1

1 Answers

2
votes

re-frame is a framework for building client-side web applications. You won't be able to do generic database queries as most databases don't support direct access from a browser.

I'm having a problem with my re-frame application. I can't figure out how to connect it to a local database on my machine.

You probably need to create a middle API tier that accepts REST requests from re-frame, and queries the database, returning JSON back to the client.

Finally, do the queries to the database, such as GET and POST requests, go in db.cljs

Those are probably queries to your API tier? They can live anywhere that you would like.

One thing to clarify: re-frame has an app-db that it uses and refers to. This is a client-side database of local state that lives in your application. It doesn't have a connection to the backend, at least not without you writing more code for it. It sounds like you might be confusing these?