Thursday 28 November 2019

Cors installed but sill getting networkError on node server

I have the local server running, and also have Cors installed using npm, and the server.js file aslet express = require("express");let cors = require('cors');let app = express();app.use(cors())app.use(function(req, res, next) {console.log(\${new Date()} - ${req.method}request for ${req.url}\);next(); // pass control to the next handler});app.use(express.static("../static"));app.listen(81, function(){console.log("Serving static on 81")});​However, once I navigate to the file, I am getting this error:Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://10.0.0.14:81/tfjs-models/mobilenet/model.json. (Reason: CORS request did not succeed).Error: Request for http://10.0.0.14:81/tfjs-models/mobilenet/model.json failed due to error: TypeError: NetworkError when attempting to fetch resource.​Any tips on how to solve this?

Submitted November 28, 2019 at 12:25PM by wymco

No comments:

Post a Comment