A
A
Alexey Yakovlev2022-02-09 16:08:39
JSON
Alexey Yakovlev, 2022-02-09 16:08:39

How to specify the correct path to the file?

The project structure is this:
6203bc1311ce6059579206.png
db.json:

{
    "products": [
        {
            "_id": "321sd",
            "img": "./src/assets/images/product/p1.png",
            "name": "Мужские Кроссовки Nike Blazer Mid Suede",
            "price": 12999
        }
    ]
}


I'm fetching data through a link - http://localhost:5000/products
I can't find a picture in this way, how to specify the correct one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zettabyte, 2022-02-09
@Zettabyte

./is the current folder.
Given that you have a localhost, as well as a project running, not quite sure what, you need to figure out which folder is considered current at the time the problem occurs.
I believe that the pictures are searched for at

http://localhost:5000/products/src/assets/images/product/p1.png
, but I can't say for sure.
Also, just in case, note that if you specify a doctype, then it must be non-strict. ./Will not work in strict .
If the folder "src" is in the root, then just try /- it will be the root of the site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question