xiaohutai / jsonapi

[Bolt Extension] JSON API for Bolt CMS
https://market.bolt.cm/view/bolt/jsonapi
MIT License
55 stars 18 forks source link

Nginx configuration #46

Closed iamajoe closed 7 years ago

iamajoe commented 7 years ago

I'm on bolt 3.2 and used this configuration for the nginx but jsonapi routes don't work. I guess I should set the nginx location for the /api. How should it be?

jsonapi configuration:

# Default configuration file for the JSON API extension.

# List the contenttypes that are to be served through the JSON extension.
# Only contenttypes listed here will be served; for any other contenttype,
# the API will return errors.
contenttypes:
    projects:
        where-clause:
            status: 'published'
        order: -datepublish
    posts:
        where-clause:
            status: 'published'
        order: -datepublish

thumbnail:
    width: 400
    height: 300

headers:
    'Access-Control-Allow-Origin': '*'
    'Content-Type': 'application/vnd.api+json'

replacements:
    'src="//': 'src="http://'
    'href="//': 'href="http://'

# The base url where the API is accessible.
base: '/api'

# If you set this to 'true', all datetime fields will be formatted as ISO 8601 dates
date-iso-8601: true

# See http://php.net/manual/en/json.constants.php
# Some recommended options:
# -   0 for no options (recommended for production)
# - 128 for pretty print (recommended for testing/development)
jsonoptions: 0
iamajoe commented 7 years ago

It seems that my issue was regarding the routing I was trying. When I go /api/projects it works. Shouldn't /api return some kind of answer like status ok for example?