📅  最后修改于: 2022-03-11 15:02:40.309000             🧑  作者: Mango
/*index.js*/
const express = require( 'express' );
const cors = require( 'cors' );
const app = express(); const port = 3030;
//cors is enabled through out the entire app
app.use( cors() );
app.get( '/users', (request, response, next) => { res.json( { info: 'cors is enabled' } ) });
app.listen( port, () => {
console.log(`App is running on ${port}`)
});