eser 3.0.3 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/hizli-api.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Hono } from "hono";
2
+ import { cors } from "hono/cors";
2
3
  const kv = await Deno.openKv();
3
4
  export function routeHome(config, ctx) {
4
5
  return ctx.json({
@@ -50,6 +51,11 @@ export function validateConfig(options) {
50
51
  export function hizliApi(options) {
51
52
  const config = validateConfig(options);
52
53
  const app = new Hono();
54
+ app.use("*", cors({
55
+ origin: "*",
56
+ allowMethods: ["GET", "OPTIONS"],
57
+ allowHeaders: ["Content-Type"],
58
+ }));
53
59
  app.get("/", (ctx) => routeHome(config, ctx));
54
60
  for (const item of config.options.items) {
55
61
  app.get(`/${item}`, (ctx) => routeItem(item, ctx));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eser",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "author": "Eser Ozvataf",
package/src/hizli-api.ts CHANGED
@@ -93,7 +93,11 @@ export function hizliApi(options: Options) {
93
93
  const config = validateConfig(options);
94
94
 
95
95
  const app = new Hono();
96
- app.use("/*", cors());
96
+ app.use("*", cors({
97
+ origin: "*",
98
+ allowMethods: ["GET", "OPTIONS"],
99
+ allowHeaders: ["Content-Type"],
100
+ }));
97
101
 
98
102
  app.get("/", (ctx) => routeHome(config, ctx));
99
103
  for (const item of config.options.items) {