skip to Main Content

Javascript – How do i fix this JSON.parse error on node.js

How to do I fix this Node.js error. const express=express(); const app=express(); const fs=require("fs"); const movies=JSON.parse=fs.readFileSync("movies.json", "utf-8"); // this line of code returns error. app.get("/api/vi/movies", (req, res)=>{ res.status(200).json({ status: "success", data: { movies: movies } }) }) app.listen(3000, "127.0.0.1", ()=>{…

VIEW QUESTION
Back To Top
Search