Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load data from JSON file in assets with NUXT.js

Suppose I have assets/data/geo/regions.json file in my NUXT.js project folders structure. How can I read data from this file into my project?

I have tried axios but I don't know what URL will have this file, I have tried all possible URLs. What is the better solution to do that? Maybe better to hold JSON files in static folder?

Thanks!

like image 683
Dmytro Zarezenko Avatar asked Mar 12 '19 15:03

Dmytro Zarezenko


1 Answers

If the regions.json file won't change, you can easily put it in the static folder. Then the url will be /data/geo/regions.json See this question on the nuxt issues page

like image 128
Muhamed Ahmatović Avatar answered Sep 21 '22 07:09

Muhamed Ahmatović