-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Steps: | ||
|
||
1. Install the web server. | ||
|
||
```console | ||
$ sudo apt install nodejs-legacy | ||
$ sudo apt install npm | ||
$ npm config set strict-ssl false | ||
$ npm install express | ||
``` | ||
|
||
2. Run the web server: | ||
|
||
Open one terminal window and run: | ||
|
||
```console | ||
$ node server1/server1.js | ||
``` | ||
|
||
```console | ||
$ node server2/server2.js | ||
``` | ||
|
||
3. In Firefox, open two tabs, one visits localhost:3000 (this visits server 1), the other visits localhost:4000 (this visits server 2). | ||
|
||
4. In server2/server2.js, enable and disable CORS (cross origin resource sharing), via commenting and uncommenting this line: | ||
|
||
```console | ||
res.header('Access-Control-Allow-Origin', 'http://localhost:3000'); // Allow Server 1 | ||
``` | ||
|
||
Observe the effects of these changes in the server 1 page. |