Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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,
);
```