Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/born05/sveltekit-proxy
A simple way to proxy paths from SvelteKit to a different server.
https://github.com/born05/sveltekit-proxy
nodejs proxy svelte sveltekit
Last synced: 10 days ago
JSON representation
A simple way to proxy paths from SvelteKit to a different server.
- Host: GitHub
- URL: https://github.com/born05/sveltekit-proxy
- Owner: born05
- License: mit
- Created: 2023-09-21T13:06:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-14T07:58:54.000Z (5 months ago)
- Last Synced: 2024-12-25T09:11:34.539Z (21 days ago)
- Topics: nodejs, proxy, svelte, sveltekit
- Language: JavaScript
- Homepage:
- Size: 47.9 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SvelteKit Proxy
A simple way to proxy paths from SvelteKit to a different server.
Install:
```
npm i -D @born05/sveltekit-proxy
```Example usage:
```ts
import { sequence } from '@sveltejs/kit/hooks';
import type { Handle } from '@sveltejs/kit';
import { proxyHandle } from '@born05/sveltekit-proxy';const svelteHandle: Handle = async ({ event, resolve }) => {
const response = await resolve(event);return response;
};export const handle = sequence(
proxyHandle({
'^/robots.txt': 'http://different-server.example.com',
'^/(nl|en)/sitemap.(xml|xsl)': 'http://different-server.example.com',
'^/(nl|en)/sitemaps-.*': 'http://different-server.example.com',
}),
svelteHandle,
);
```