@fleek-platform/proxy
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

⚡️Fleek Proxy

Conventional Commits

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:

  1. 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
  1. Push Changes and Tags
git push origin main --follow-tags
  1. 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

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature-branch-name.
  3. Make your changes.
  4. Commit your changes using conventional commits.
  5. Push to your fork and submit a pull request.

Commit Guidelines

We use Conventional Commits for our commit messages:

  • test: 💍 Adding missing tests
  • feat: 🎸 A new feature
  • fix: 🐛 A bug fix
  • chore: 🤖 Build process or auxiliary tool changes
  • docs: ✏️ Documentation only changes
  • refactor: 💡 A code change that neither fixes a bug or adds a feature
  • style: 💄 Markup, white-space, formatting, missing semi-colons...

Package Sidebar

Install

npm i @fleek-platform/proxy

Weekly Downloads

7

Version

0.1.0

License

MIT

Unpacked Size

30.3 kB

Total Files

19

Last publish

Collaborators

  • kkudriaiev
  • utibeabasi6
  • fleek.xyz
  • arslan.b3a
  • helderxyz
  • gabriel.fleek