Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

Install Cors

$ npm i express cors
Comment

npm cors api use

npm install cors
var cors = require("cors");

CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.
Comment

cors package install npm

var express = require('express')var cors = require('cors')var app = express() app.get('/products/:id', cors(), function (req, res, next) {  res.json({msg: 'This is CORS-enabled for a Single Route'})}) app.listen(80, function () {  console.log('CORS-enabled web server listening on port 80')})
Comment

cors package install npm

var express = require('express')var cors = require('cors')var app = express() app.use(cors()) app.get('/products/:id', function (req, res, next) {  res.json({msg: 'This is CORS-enabled for all origins!'})}) app.listen(80, function () {  console.log('CORS-enabled web server listening on port 80')})
Comment

PREVIOUS NEXT
Code Example
Shell :: find in terminal 
Shell :: terraform 
Shell :: bash list columns 
Shell :: how to change git commit date 
Shell :: bash shuffle lines 
Shell :: git percentage of authorship 
Shell :: How to clean up the git repo and reduce its disk size 
Shell :: colcon reset build 
Shell :: Create Remote for Contributing to a GitHub project 
Shell :: connect to remote redis over tls 
Shell :: how to get data from pc to cluster 
Shell :: Install Deno - Shell (Mac, Linux) 
Shell :: abort current task mac terminal 
Shell :: Installing gitflow locally 
Shell :: ssh change pasword to key file 
Shell :: git debug 
Shell :: xsl fo when else 
Shell :: ubuntu install meslo font 
Shell :: No project found at or above and neither was a --path specified 
Shell :: zotero linux chromeos 
Shell :: how to install wintricks 
Shell :: powershell invoke 
Shell :: extract path from url sed 
Shell :: c pipe 2 arguments 
Shell :: manjaro gnome poweroff too long 
Shell :: not found 91.189.88.142 ubuntu 
Shell :: how to compress all branches on branch into one branch back to the master 
Shell :: git copy stash entry from one repo to another 
Shell :: bash merge directories 
Shell :: how to pass k8s secret in run command line 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =