“Cant Connect Express.js Server ke Frontend Angular” Kode Jawaban

Cant Connect Express.js Server ke Frontend Angular

constructor() {
  this.app = express()
}

Initialize{
    this.app.use((req, res, next) => {
      res.header('Access-Control-Allow-Origin', '*');
      res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
      res.header('Access-Control-Allow-Methods', 'OPTIONS, GET, POST, PUT');
      if('OPTIONS' === req.method){
        res.sendStatus(200);
      }
      else {
          next();
      }
    })

  this.app.use(RouterWebservices)

    this.app.listen(your.HttpPort, your.Ip, () => {
      console.log('Server now listening at ', your.HttpPort, 'IP ', your.Ip);
    })
}
SAMER SAEID

Cant Connect Express.js Server ke Frontend Angular

export const RouterWebservices = express.Router()

RouterWebservices.get('/fetchdata', FetchWebservice)
SAMER SAEID

Jawaban yang mirip dengan “Cant Connect Express.js Server ke Frontend Angular”

Pertanyaan yang mirip dengan “Cant Connect Express.js Server ke Frontend Angular”

Lebih banyak jawaban terkait untuk “Cant Connect Express.js Server ke Frontend Angular” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya