chore: update server
04949e6f
1 file(s) · +1 −18
| 12 | 12 | ||
| 13 | 13 | const app = new Hono<{ Bindings: Env }>(); |
|
| 14 | 14 | ||
| 15 | - | // Configure CORS to allow credentials from the client |
|
| 16 | - | app.use( |
|
| 17 | - | cors({ |
|
| 18 | - | origin: (origin) => { |
|
| 19 | - | // Allow requests from the client URL and localhost for development |
|
| 20 | - | const allowedOrigins = [ |
|
| 21 | - | "https://stevedylan.dev", |
|
| 22 | - | "http://localhost:4321", |
|
| 23 | - | "http://localhost:3000", |
|
| 24 | - | ]; |
|
| 25 | - | return allowedOrigins.includes(origin) ? origin : allowedOrigins[0]; |
|
| 26 | - | }, |
|
| 27 | - | credentials: true, |
|
| 28 | - | allowMethods: ["GET", "POST", "OPTIONS"], |
|
| 29 | - | allowHeaders: ["Content-Type"], |
|
| 30 | - | }), |
|
| 31 | - | ); |
|
| 32 | - | ||
| 15 | + | app.use(cors()); |
|
| 33 | 16 | app.route("/", home); |
|
| 34 | 17 | app.route("/now", now); |
|
| 35 | 18 | app.route("/auth", auth); |