I am currently writing Angular as front end and node.js as backend application.
Phones and other network PCs do not load the resources either all duue to CORS issue. Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:3000/api/news. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 404 However I do have CORS in my code, any suggestions to try? const express = require('express'); const app = express(); const bcrypt = require('bcrypt'); const jwt = require('jsonwebtoken'); const sqlite3 = require('sqlite3').verbose(); const path = require('path'); // Required for serving static files const PORT = process.env.PORT || 3000; const cors = require('cors'); app.use(cors({ origin: '*', // Allow both local and network access methods: 'GET,POST,PUT,DELETE,OPTIONS', allowedHeaders: 'Content-Type,Authorization', credentials: true // Allow cookies if necessary })); app.options('*', cors()); // Middleware for parsing JSON app.use(express.json()); // For serving static assets like images app.use('/assets', express.static(path.join(__dirname, 'assets'), { setHeaders: (res) => { res.setHeader('Access-Control-Allow-Origin', '*'); } })); -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/angular/e5c731c8-8fed-4690-b66a-cfb9accf2203n%40googlegroups.com.