node.js study note 4 use express to write interface, interface cross domain problem, CORS, JSONP interface

1. Use expressions to write interface 1.1 create a basic server // Import express const express = require('express') // Create server instance const app = express() app.listen(80,() => { console.log('express server running at http://127.0.0.1'); }) 1.2 create api routing module // apiRouter. JS (routing module) const express = ...

Added by wutanggrenade on Mon, 31 Jan 2022 08:59:31 +0200

What is cross domain resource sharing (CORS)?

1, What is CORS? For security reasons, the browser restricts cross domain HTTP requests initiated by scripts unless the server agrees to access. For example, if the server's response Header to the pre check request contains access control allow origin: *, the cross domain request can be accessed correctly. 2, Examples of hazards If the mal ...

Added by gargoylemusic on Wed, 24 Nov 2021 02:38:20 +0200