This project demonstrates how to use Express to handle basic CORS errors when making a request to an API that implements CORS.
Unlike the Quote Card Express assignment, this project does not serve a static site on the same port. Instead, we will serve our front-end using the Live Server VS Code extension.
using-the-no-as-a-service-api/
├─ back-end/
│ └─ server.js
|─ js/
| └─ index.js
├─ .gitignore
├─ index.html
├─ package-lock.json
├─ package.json
└─ README.md
Tools |
---|
Node.js |
Live Server VS Code extension |
- If Node.js has not been installed on your computer, please visit https://nodejs.org/en/download to download and installed.
- Verify that NodeJS and npm is installed correctly.
- In Git Bash, run the following commands:
node -v
andnpm -v
- If both commands return a version number, you have successfully installed Node.js
- In Git Bash, run the following commands:
- Clone down this project into the directory of your choice.
- Open the project in VS Code.
- In the integrated terminal, run
npm install
to install the required packages. - To serve the back-end, run
npm run dev
in the terminal - Right-click
index.html
and selectOpen with Live Server
. index.html
will display the "No" reason in the<h1>
element.