Categories
Mastering Development

net::ERR_CONNECTION_REFUSED – Problem with CORS, Heroku App and NodeJS

i’m facing a ERR_CONNECTION_REFUSED on client-side, hosted on heroku app and my node back-end server, running in my PC. i have configured CORS on server.js this way: var express = require(‘express’) var cors = require(‘cors’) var port = process.env.PORT || 5000 var app = express() app.use(cors()); app.use(express.json()) app.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", "*") res.header(‘Access-Control-Allow-Methods’, ‘GET,PUT,POST,DELETE’); […]

Categories
Mastering Development

configure nodejs rest api server and vue project with axios cors policy error

as the title sais, i’m trying to configure a local rest api server running node js and in the meantime i have a vue project with axios. i surfed the whole internet, tried every server/client configuration, server headers settings, cors package, axios header config, but i still have cors policy error inthe console. postman works […]

Categories
Mastering Development

socket.io + React + Node.js, “No ‘Access-Control-Allow-Origin’ header is present on the requested resource.”

I am a fairly new developer and recently I tried to develop a rather simple chat application using Socket.io. It has all gone pretty well and everything works locally. The problems started when I tried to deploy both my client and my server. Background The server is deployed on Heroku. The client is deployed on […]

Categories
Mastering Development

Node, Express API App on Azure giving Container Start Failure error

I have an existing Node and Express API application which I am trying to deploy to Azure WebApps. Deployment goes fine. But when I try to access the APIs, nothing happens. When I check log, I see following: "Container chdemoapi_0_f2df43ac didn’t respond to HTTP pings on port: 8080, failing site start""Container chdemoapi_0_4e583132 didn’t respond to HTTP […]

Categories
Mastering Development

Access-control-allow-origin is not allowed by Access-Control-Allow-Headers in preflight response

I have prepared an Lambda function using Express(node.js) and enabled the Authorization with IAM as well. The API is working in the Postman as per below link : https://www.youtube.com/watch?v=KXyATZctkmQ&t=35s As I’m fairly new with CORS policy and API concepts. I’m trying to access the sample using Ajax call. So far I have prepared the Authorization […]

Categories
Mastering Development

Express API Trying To Serve Public Files Gives 404

I currently have an API setup like so… index.js require(‘dotenv’).config(); const index = require(‘./server’); const port = process.env.PORT || 5000; index.listen(port, () => console.log(`Server is live at localhost:${port}`)); module.exports = index; server/index.js const express = require(‘express’); const routes = require(‘../routes’); const bodyParser = require(‘body-parser’); const helmet = require(‘helmet’); const morgan = require(‘morgan’); const path = […]

Categories
Mastering Development

Node Crash on AWS CentOS 7 when posting json

I have a very simple app that has been working with for over year and on different flavors of Linux and windows. The only difference is I’ve spun a box on AWS that is using CentOS version 7.7.1908 with Mongo 4.2.5 and Node 12.16.0. I’m currently running the exact same code on Windows 10 and […]

Categories
Mastering Development

Angular 9 application is stuck on Microsoft Edge

I have an Angular app generated with the CLI. Angular version 9.0.6 This app loads perfectly on Internet Explorer 11 but doesn’t in Edge. in Edge, the network request shows that some bundles are pending and they don’t finish downloading, thus it says not responding. I am also suspecting a NPM package called ngx-swiper-wrapper(9.0.1) as […]

Categories
Mastering Development

CORS problems on node.js

I have a web app with a Node.js backend and Angular front end, both on the same server (Windows Server 2016), however, using different domains. So the front-end is at http://frontend.mydomain.com and the backend is at http://backend.mydomain.com. Unfortunately I didn’t write this web app, nor do I have any experience with Node.js or Angular. The […]

Categories
Mastering Development

How to serve a Nodejs & Express app using Phusion Passanger

I have a node & express app that is currently hosted on a shared hosting. I would like to run and manage the app using Phusion Passenger. My hosting account supports nodejs applications managed by Passenger which i have never used before. The server code generated when setting up the Node app is the basic […]