@fleek-platform/proxy
v0.1.0
Published
Proxy for your Fleek edge functions
Downloads
5
Readme
⚡️Fleek Proxy
fleek-proxy
is a lightweight JavaScript package designed to route incoming requests and act as an API Gateway for your app. Built for edge function services, it helps forward and proxy requests to the appropriate destinations.
Features
- Flexible Routing: Configure custom routes with wildcards.
- Proxy Requests: Forward HTTP requests to specified destinations.
- Default Route: Set up a default route to catch unmatched paths.
- Seamless Integration: Written in TypeScript for type safety.
Installation
- npm
npm install @fleek-platform/proxy
- pnpm
pnpm install @fleek-platform/proxy
Usage
Here's a basic example of a Fleek edge function, demonstrating how to configure and use the proxy package.
import { createProxy, FleekRequest, FleekResponse } from '@fleek-platform/proxy';
// Define your routing rules
const proxy = createProxy({
routes: {
routes: {
'/api/': 'https://api.foo.com/',
'/external/': 'https://external-service.com/',
},
default: 'https://fallback-service.com/',
},
});
export async function main(req: FleekRequest): Promise<FleekResponse> {
return await proxy.proxyRequest(req);
}
Release Process
This project follows SemVer for versioning. Here's how to release a new version:
- Update Version Number: Bump the version number in package.json using npm version (patch/minor/major). This will update the version number in package.json and create a new Git tag.
pnpm version patch
- Push Changes and Tags
git push origin main --follow-tags
- GitHub Actions Automation: A GitHub Actions workflow automatically publishes the package to npm when a new tag is pushed.
Contributing
Thanks for considering contributing to our project!
How to Contribute
- Fork the repository.
- Create a new branch:
git checkout -b feature-branch-name
. - Make your changes.
- Commit your changes using conventional commits.
- Push to your fork and submit a pull request.
Commit Guidelines
We use Conventional Commits for our commit messages:
test
: 💍 Adding missing testsfeat
: 🎸 A new featurefix
: 🐛 A bug fixchore
: 🤖 Build process or auxiliary tool changesdocs
: ✏️ Documentation only changesrefactor
: 💡 A code change that neither fixes a bug or adds a featurestyle
: 💄 Markup, white-space, formatting, missing semi-colons...