A
A
aweui2018-12-29 14:29:14
Database
aweui, 2018-12-29 14:29:14

DB interaction in nuxt.js?

Hello.
There is a nuxt.js project that will grow a little, which involves interacting with the database.
How does it work in practice? For example, there is an articles.vue template that will fetch records from the database.
What would this code look like in general? Will something in json format arrive in the template, most likely (like mongo)?
If someone gives a link to an example with code, I would be very grateful.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Filippenko, 2018-12-29
@aweui

https://github.com/cretueusebiu/laravel-nuxt
The bottom line is that Nuxt should send Ajax requests to the server backend (in this example in PHP, but it doesn’t matter what), and the server should return data from the database, preferably in JSON format.
That is, it is not Naxt that should directly interact with the database, but the back, which Naxt is already knocking on.
There are plenty of examples with the same axios.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question