Code Monkey home page Code Monkey logo

Comments (5)

Koleok avatar Koleok commented on May 19, 2024

This would be a great change to make as its intended to be a public api

from poetrydb.

marktnoonan avatar marktnoonan commented on May 19, 2024

I use a short PHP script to fetch the data and get around the CORS objection. Not the perfect solution, but you can see it in action here: https://github.com/oddlyaromatic/no-repeat-poets/blob/master/poem-getter.php.

I basically run into CORS issues so often that simply running the request from the server and passing the response back to my JS code is my default solution, and pretty quick to implement.

For really quick in-browser testing, I use this: https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en

It's useful but it will mess up your experience if you accidentally turn it on for regular websites you are just visiting.

I agree it would be nice if this were amended on the server :)

from poetrydb.

Koleok avatar Koleok commented on May 19, 2024

Thanks @oddlyaromatic !

FYI I also found https://market.mashape.com/thundercomb/poetry-db which solved my silly little use case for a demo app :)

from poetrydb.

thundercomb avatar thundercomb commented on May 19, 2024

The 'Access-Control-Allow-Origin' header has been added thanks to @tenyo's change.
The pull request has been merged and pushed to the app.

It is now live:

$ curl -H "Origin: http://example.com" --verbose http://poetrydb.org/
*   Trying 52.5.226.222...
* TCP_NODELAY set
* Connected to poetrydb.org (52.5.226.222) port 80 (#0)
> GET / HTTP/1.1
> Host: poetrydb.org
> User-Agent: curl/7.54.0
> Accept: */*
> Origin: http://example.com
> 
< HTTP/1.1 302 Found
< Server: Cowboy
< Connection: keep-alive
< Date: Sun, 13 Jan 2019 10:29:58 GMT
< Status: 302 Found
< Content-Type: text/html;charset=utf-8
< Location: http://poetrydb.org/index.html
< Access-Control-Allow-Origin: *
< Content-Length: 0
< Via: 1.1 vegur
< 
* Connection #0 to host poetrydb.org left intact

from poetrydb.

thundercomb avatar thundercomb commented on May 19, 2024

This issue will now be closed but if there are further concerns around it feel free to open a new one.

from poetrydb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.