Comments (5)
This would be a great change to make as its intended to be a public api
from poetrydb.
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.
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.
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.
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)
- HTTPS API call HOT 3
- Contributions/posting to DB HOT 6
- Linecount comparison is not correct HOT 3
- Search for multiple terms not working HOT 1
- Limit the number of results? HOT 3
- Including poetry HOT 2
- [Feature Request] Random Endpoint HOT 4
- Search and return random poems HOT 1
- Expand test cases HOT 1
- Link to Author Webpage HOT 10
- Heroku Application Error HOT 4
- Cannot find proper information related to endpoints for different REST operations
- Set maximum linecount HOT 4
- 500 Internal Server Error for Swinburne "Hymn..." HOT 1
- Missing a poem, how can we add to the dB ? HOT 3
- Getting all authors HOT 1
- API Is Down HOT 2
- 503 Status Error - Application Error on Heroku HOT 7
- README.md formatting error
- The /random call seems biased
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poetrydb.