This project serves as a foundation for handling Cross-Origin Resource Sharing (CORS) issues when building back-end applications. It demonstrates how to configure a Node.js server to allow or restrict access to external APIs from different origins.
- Configurable CORS settings
- Basic server setup for API requests
-
Clone or fork this repository:
git clone https://github.com/Thinkful-Ed/starter-cors-back-end.git
-
Navigate to the project directory:
cd starter-cors-back-end
-
Install dependencies:
npm install
-
Start the server:
npm start
To run in development mode (with auto-reload):
npm run start:dev
-
Set the
PORT
environment variable if needed. The default is5555
.
The application starts a server on the specified port, allowing requests from different origins based on CORS configuration. This starter code helps with setting up an API backend that interacts with various front-end clients.
- Node.js: JavaScript runtime for building server-side applications.
- Express: Web framework for managing server routes and middleware.
- CORS: Configurable middleware for handling cross-origin requests.