Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from qpoint-io/rename-to-endpoint
Browse files Browse the repository at this point in the history
The great endpoint migration
  • Loading branch information
jonfriesen authored Jan 5, 2024
2 parents 56b7346 + 307ee87 commit 8bec5ec
Show file tree
Hide file tree
Showing 15 changed files with 7,179 additions and 5,190 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build & Test

on:
pull_request:
push:
branches:
- main

jobs:
build:
name: build & test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: 'https://registry.npmjs.org/'

- name: Install Node dependencies
run: npm ci

- name: Run Node build (if present)
run: npm run build --if-present

- name: Run Tests (if present)
run: npm test --if-present
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release
on:
push:
tags:
- "v*"

jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: 'https://registry.npmjs.org/'

- name: Install Node dependencies
run: npm ci

- name: Update version in package.json
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/}
npm version $TAG_VERSION --no-git-tag-version
- name: Run Node build (if present)
run: npm run build --if-present

- name: Publish NPM package
run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
7 changes: 0 additions & 7 deletions .vscode/settings.json

This file was deleted.

16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Qpoint

Intelligence at the edge - an edge router framework
Intelligence at the edge - an edge endpoint framework

Compose powerful edge capabilities to analyze, transform, reject, or proxy traffic as it passes through the edge to your apps.

Designed to run within [worker runtimes](https://workers.js.org/), a qpoint router can be deployed trivially to edge networks like [Cloudflare Workers](https://workers.cloudflare.com/) and [Deno Deploy](https://deno.com/deploy), or with the help of [Qpoint](https://qpoint.io), deploy to any platform including your own servers.
Designed to run within [worker runtimes](https://workers.js.org/), a qpoint endpoint can be deployed trivially to edge networks like [Cloudflare Workers](https://workers.cloudflare.com/) and [Deno Deploy](https://deno.com/deploy), or with the help of [Qpoint](https://qpoint.io), deploy to any platform including your own servers.

## Example

```ts
import Router from '@qpoint/router'
import Endpoint from '@qpoint/endpoint'
import proxy from '@qpoint/proxy'
import maskUrls from '@qpoint/mask-urls'
import replaceContent from '@qpoint/replace-content'
import rewriteHtml from '@qpoint/rewrite-html'

// initialize and export the router
export default new Router()
// initialize and export the endpoint
export default new Endpoint()

// proxy request to app
.use(proxy({ appUrl:"https://qdemo.io" }))
Expand All @@ -37,7 +37,7 @@ Adapters are middleware functions to be executed in a chain, each potentially mo

Example: Reject the request (at the edge) if no auth is provided
```ts
router.use((ctx: Context, next: Function) => {
endpoint.use((ctx: Context, next: Function) => {

// check for the Authorization header
if (!ctx.request.headers.has("Authorization")) {
Expand All @@ -59,7 +59,7 @@ router.use((ctx: Context, next: Function) => {
Each adapter receives a Qpoint [Context](https://github.com/qpoint-io/qpoint/blob/main/src/context.ts) object that wraps an incoming request and the corresponding response. `ctx` is often used as the parameter name for the context object.

```ts
router.use(async (ctx: Context, next: Function) => { await next(); });
endpoint.use(async (ctx: Context, next: Function) => { await next(); });
```

After each of the adapters have run, the response as set on the context will be returned.
Expand All @@ -71,3 +71,5 @@ A very common case for Qpoint is building intelligent proxies and load balancers

In such a scenario, adapters that need to modify the request before a proxy fetch occurs will sequencially modify or replace the `proxy` instance as the chain progresses.

## Releasing New Versions
To release a new version create a `New Release` in GitHub with an incremented tag in the format of `v#.#.#`. GitHub will automatically generate the changelog since the last release version. After creation, a GitHub action will be kicked off to build, tests, set the npm version, and publish.
30 changes: 30 additions & 0 deletions examples/deno/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/deno/import_map.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"imports": {
"$std/": "https://deno.land/[email protected]/",
"@qpoint/router": "https://esm.sh/@qpoint/[email protected]?bundle"
"@qpoint/endpoint": "../../dist/index.js"
}
}
}
Loading

0 comments on commit 8bec5ec

Please sign in to comment.