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

express custom middleware handles post requests

preface express's built-in urlencoded () has compatibility problems. We use node's querystring to encapsulate a middleware for processing post requests for ease of use. 1, Built in middleware (common) Implementation code and notes const express = require('express'); const app = express(); // Built in middleware common // express.st ...

Added by accident on Sat, 15 Jan 2022 20:54:46 +0200