This repository contains the setup for an Express Gateway API that proxies requests to a backend Excel API service.
This Express Gateway API serves as a middleware that routes requests to an Excel API backend. It provides a centralized point of access and includes basic policies for managing API traffic.
- Node.js (version 12 or higher)
- npm (Node Package Manager)
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Install dependencies:
npm install
-
Edit
gateway.config.ymlto configure services and policies:http: port: 3001 services: your_excel_api: url: 'http://localhost:3000' policies: - proxy: - action: serviceEndpoint: your_excel_api changeOrigin: true rewritePath: '^/api/data/(.*) /api/data/$1'
- Replace
your_excel_apiwith the name of your backend service endpoint. - Adjust
urlto match your backend service URL.
- Replace
-
Start the Express Gateway server:
eg gateway start
-
Access your gateway API at:
http://localhost:3001/api/dataEnsure your backend Excel API (
http://localhost:3000/api/data) is running and accessible.
- GET /api/data: Retrieves data from the Excel API.
- POST /api/data: Adds new data to the Excel API.
- PUT /api/data/:id: Updates data in the Excel API.
- DELETE /api/data/:id: Deletes data from the Excel API.
- Check console logs for any errors or warnings.
- Ensure backend services are correctly configured and accessible.
- Express Gateway - API Gateway for Express.js
- Node.js - JavaScript runtime
- npm - Node Package Manager
This project is licensed under the MIT License - see the LICENSE file for details. © 2024 Ashin Varghese. All rights reserved.
- Express Gateway community for providing a powerful API gateway solution.