Skip to content

Commit 147296f

Browse files
authored
chore: remove cors middleware (#732)
1 parent 9048ad7 commit 147296f

File tree

19 files changed

+414
-273
lines changed

19 files changed

+414
-273
lines changed

documentation/docs/examples/concepts.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,6 @@ Middleware is useful for manipulating requests and responses. In this example we
6868

6969
[View in repository](https://github.com/MaskingTechnology/jitar/tree/main/examples/middleware){target="_blank"}
7070

71-
## Cors
72-
73-
When the frontend of the application is not hosted by Jitar you want to enable cors on the web server. Jitar provides a cors middleware and in this example we demonstrate how to enable cors.
74-
75-
[View in repository](https://github.com/MaskingTechnology/jitar/tree/main/examples/cors){target="_blank"}
76-
7771
## Construction
7872

7973
When starting and stopping a Jitar service, it might be useful to do additional tasks. In this example the use of start up and tear down scripts is demonstrated.

documentation/docs/integrate/rpc-api.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -325,24 +325,3 @@ export default PersonNotFound extends NotFound
325325
get id(): string { return this.#id; }
326326
}
327327
```
328-
329-
## CORS
330-
331-
Depending on the external application, CORS headers might be required to allow the connection. Jitar provides a CORS middleware implementation that you can use out-of-the-box.
332-
333-
```ts
334-
// src/handleCors.ts
335-
import { CorsMiddleware } from 'jitar';
336-
337-
const origin = 'https://example.com';
338-
const headers = 'X-Custom-Header-1, X-Custom-Header-2';
339-
const cors = new CorsMiddleware(origin, headers);
340-
341-
export default cors;
342-
```
343-
344-
This CORS handler needs to registered to a service in order to work. More information on this can be found in the [middleware](../develop/middleware#adding-middleware) section of the develop guide.
345-
346-
Only a single origin is supported. If you need a multi-domain setup you can provide a * (wildcard). The allowed headers are specified in a comma-separated list. You can also use a * (wildcard) to allow all. By default the CORS middleware will use a wildcard for the domain and headers if not specified.
347-
348-
The values for the allowed method are fixed to GET and POST, as these are the only methods the RPC API exposes.

examples/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,4 @@ The following projects focus on one particular concept at a time. The examples a
3333
1. [Error handling](error-handling/README.md) - Demonstrates how to the error handling works.
3434
1. [Health checks](health-checks/README.md) - Demonstrates how to use health checks.
3535
1. [Middleware](middleware/README.md) - Demonstrates how to use middleware.
36-
1. [Cors](cors/README.md) - Demonstrates how to enable cors.
3736
1. [Resources](resources/README.md) - Demonstrates how to use resources.

examples/cors/README.md

Lines changed: 0 additions & 57 deletions
This file was deleted.

examples/cors/jitar.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/cors/package.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

examples/cors/requests.http

Lines changed: 0 additions & 2 deletions
This file was deleted.

examples/cors/segments/server.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/cors/services/standalone.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/cors/src/app.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)