cmorten / opine

Minimalist web framework for Deno ported from ExpressJS.
https://github.com/cmorten/opine/blob/main/.github/API/api.md
MIT License
854 stars 43 forks source link

[DOCS] Cors Enablements #56

Closed michael-spengler closed 4 years ago

michael-spengler commented 4 years ago

First of all: Thank you for this module.

As I could not find a simple & quick solution for cors enablement so far, I created a corresponding PR on https://deno.land/x/cors.

If you know any better approaches, please let me know.

asos-craigmorten commented 4 years ago

Heya @michael-spengler 👋

Ah awesome, A CORs module is a great contribution to have somewhere so nice one! I'm not aware of any alternative cors libraries atm so your PR is great to have.

Given Mith, Attain and Opine are all essentially connect middleware inspired I wonder if a single exported module could handle cors for all of them but that can be for another time!

Once the PR is in it would be awesome to get something added to the Opine examples if you have the time? (Or I can if busy 😄)

michael-spengler commented 4 years ago

Hey @asos-craigmorten. Today was a cors day for me - I started at about level 0 :) so the PR from above got merged - the owner of the repository will fix some issues which I had left due to my beginner level in those topics :)

To have a quick solution for uncritical apps / backend / routes I provided https://deno.land/x/simplecors@1.0.0 where I use opine for the usage example. This is sufficient for me as I'm mostly developing uncritical fun apps. Therefore I close this issue.

michael-spengler commented 4 years ago

Good News:

The following works now:

import { opineCors } from "https://deno.land/x/cors/mod.ts";
const app = opine();
app.use(opineCors())

Reopening this issue so you can check whether you want to update the documentation. @asos-craigmorten

asos-craigmorten commented 4 years ago

Amazing @michael-spengler! Yep think would be great to get an example in the repo using this 😊

jvmazagao commented 4 years ago

Hey @asos-craigmorten, can we close this issue and open another for the docs, to be more legible and organized.