Setting up CORS

    A good flowchart for implementing CORS support Reference:

    CORS server flowchart

    You can read the specification here:

    For simple CORS requests, the server only needs to add the following header to its response:

    Add the following route as the last route:

    Access-Control-Allow-Methods

    The following middleware can be used to query Slim’s router and get a list of methods a particular pattern implements.