Sallis-GH / basic-cors-server

A basic setup for how a front-end and back-end will look with CORS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Basic CORS Server

Description

This is a simple application that demonstrates the use of Cross-Origin Resource Sharing (CORS). It consists of a client and a server. The client sends a request to the server, and the server responds to the request.

Features

  • Client-server communication using CORS
  • Visual feedback in the client when the server responds

Prerequisites

  • Node.js
  • npm

Installation

  1. Clone the repository to your local machine.
  2. Navigate to the client directory and run npm install to install the client dependencies.
  3. Navigate to the server directory and run npm install to install the server dependencies.

Configuration

No additional configuration is required.

Usage

To start the server, navigate to the server directory and run npm start.

To start the client, navigate to the client directory and run npm start.

Open a web browser and navigate to http://localhost:3000 to view the client.

Examples

Click the "Ping Backend" button in the client to send a request to the server. The server will respond and the client will display the response.

Troubleshooting

If you encounter a "Failed to load resource: the server responded with a status of 404 (Not Found)" error, make sure that the server is running and that the client is correctly configured to send requests to the server's URL.

About

A basic setup for how a front-end and back-end will look with CORS.


Languages

Language:CSS 59.7%Language:JavaScript 26.8%Language:HTML 13.5%