How to deploy a website with JSON Server and React

I have a react page which utilises JSON Server. This decision was made due to the client's request and we cannot change the method. I am trying to keep it only as a frontend project and trying to not include backend material. I tried to import JSON Server in an express file. But it brings up an error of module not found. I looked deep into the error and found that it is ES6 issue but i cant fix it . Then i tried using concurently which runs both npm run start and npm run server but also dosen't do anything. { "name": "christ-church", "private": true, "version": "0.0.0", "type": "module", "scripts": { "dev": "vite", "build": "vite build", "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", "start": " concurrently "node server.js" " npm run server"", "server": "json-server --watch db.json -s ./dist --port 5000" }, "dependencies": { "common": "^0.2.5", "express": "^4.19.2", "json-server": "^1.0.0-beta.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-icons": "^5.2.1", "react-lazyload": "^3.2.1", "react-router-dom": "^6.23.1", "react-toastify": "^10.0.1", "validator": "^13.12.0" }, "devDependencies": { "@types/react": "^18.2.66", "@types/react-dom": "^18.2.22", "@vitejs/plugin-react": "^4.2.1", "concurrently": "^8.2.2", "eslint": "^8.57.0", "eslint-plugin-react": "^7.34.1", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.6", "vite": "^5.2.0" } } This is my package.json The attachments provided is the error and the server.js file code
No description
No description
1 Reply
b1mind
b1mind•5mo ago
Not sure why a client would pick this, it's just for mock data. Why not just import the json file and brrrrrre Beta and for mock data 🤔
Want results from more Discord servers?
Add your server