Hey i want to get the data from my json file and then display it in html, but first i will just console.log it. how do i exactly do that?? the json file will be updated as its the users input
varer.json
[{"id":"aa","varer":"aa","pris":""},{"id":"aa","varer":"aa","pris":""}]
varer-controller
const varerModel = require("./../models/varer");
const express = require("express");
const router = express.Router();
router.get("/getproducts", (req, res) =>{
var products = JSON.parse(varerModel)
console.log(products)
res.send(products)
})
You don't need to JSON.parse as it's already a JSON and can be directly used.