Delivery-focussed Elixir, Python, XSL/XQuery, (No)SQL, and Agile consultancy, specialising in content migration, API design, and (micro)services.

LinkedIn Octocat RSS

CORS and Ramses

Recently I used Ramses to quickly knock-up a mock service for a React developer I’m working with, so he could make headway while the team built-out the API he would eventually use.

If you’ve not seen Ramses it’s a great little framework for knocking up RESTish APIs quickly.

One issue we found out pretty quickly is that the documentation for CORS in Ramses is non-existant, and those for Nefertari, the REST API framework Ramses uses on top of Pyramid, is minimal at best.

Following the docs will only get you half-way there. What you’ll also need to do is add the options method in your RAML config for the root endpoint, so that the CORS preflight check passes.

For example:

/api:
    get:
        description: ...
    options:
        description: ...
    post:
        description: ...

Hope this helps!


Originally posted: Apr 05 2016