Skip to content

Commit

Permalink
Update readme and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelreichor committed Nov 13, 2024
1 parent 20d77fc commit e1069d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 99 deletions.
6 changes: 2 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
## 1.0.3 - 2024-10.31
- Change composer package name to my real repo name.

## 1.0.4 - 2024-11.08
## 1.1.0 - 2024-11.08

### Changes
- Change API endpoints from `/<version>/api/controlername` to `/<version>/api/queryApi/controlername`.
- Cache duration is now the default craft cache duration defined in `/config/general.php`.
- Update readme

### Fixes
- Fix formatting issues in all php files.
- Fix missing title field in matrix transformer.

104 changes: 9 additions & 95 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<br>
<h1 align="center">The Query API for Craft CMS</h1>
<p align="center">
Craft Query API is a Craft CMS plugin to use the loved query builder in your favorite js-framework.
Craft Query API is a Craft CMS plugin that brings the query builder in your favorite js-framework.
</p>
<br/>
</div>
Expand Down Expand Up @@ -40,104 +40,18 @@

This plugin requires Craft CMS 5.0.0 or later, and PHP 8.2 or later.

## Qick start
## Documentation

1. Set up a craft project by using that guide: https://craftcms.com/docs/getting-started-tutorial/install/
2. Install the Craft Query API Plugin using that command:
```bash
composer require samuelreichor/craft-query-api && php craft plugin/install craft-query-api
```
3. Add following config to prevent cors origin errors in that file `config/app.web.php`
```php
<?php
return [
'as corsFilter' => [
'class' => \craft\filters\Cors::class,
// Add your origins here
'cors' => [
'Origin' => [
'http://localhost:3000',
'http://localhost:5173',
],
'Access-Control-Request-Method' => ['GET'],
'Access-Control-Request-Headers' => ['*'],
'Access-Control-Allow-Credentials' => true,
'Access-Control-Max-Age' => 86400,
'Access-Control-Expose-Headers' => [],
],
],
];
```

4. That's it you can test it by hitting that endpoint `${PRIMARY_SITE_URL}/v1/api/customQuery`. You should get an empty
array as response.
## Optional things to configure:
### Set headless mode in your `config/general.php` to `true`
Read more about the headless
mode [here](https://craftcms.com/docs/getting-started-tutorial/more/graphql.html#optional-enable-headless-mode).
### Tell Craft where your frontend lives
This is important, to get previews of entries working.
Add a new env var:
```
WEBSITE_URL="http://localhost:3000"
```
Add new alias in the config/general.php:
```
->aliases([
'@web' => getenv('PRIMARY_SITE_URL'),
'@websiteUrl' => getenv('WEBSITE_URL'),
])
```
And finally go to your control panel settings -> sites -> and change the base URL of your Site.
### Configure ImagerX
If you are using ImagerX (what I recommend) then you have to generate all transforms of the images before you can query
them. Therefore you need a `imager-x-generate.php` File in your config folder with all named transforms in it. This can
look like that:
```php
<?php
return [
'volumes' => [
'images' => ['auto', 'square', 'landscape', 'portrait', 'dominantColor'],
]
];
```
The plugin will automatically detect the named transforms and widths defined in your `imager-x-transforms.php`. In the
response, you'll get an object where the key is the name of the transform, and the value is a srcset of all defined
transforms.

### Configure SEO Matic

Seo Matic has its own Endpoints. You can enable these in the plugin setting.
Visit the Craft [Query API Plugin page](https://samuelreichor.at/libraries/craft-query-api) for all documentation, guides, pricing and developer resources.

## Further Resources

- [Core JS Query Builder](https://github.com/samuelreichor/js-craftcms-api)
- [Craft CMS Vue Plugin](https://github.com/samuelreichor/vue-craftcms)
- [Craft CMS Nuxt Plugin](https://github.com/samuelreichor/nuxt-craftcms)

## Support

- Bugs or Feature Requests? [Submit an issue](/../../issues/new).

## Contributing
- [Vue Craft CMS](https://samuelreichor.at/libraries/vue-craftcms): A package to use the query builder in Vue.
- [Nuxt Craft CMS](https://samuelreichor.at/libraries/nuxt-craftcms): A package to use the query builder in Nuxt.
- [JS Craft CMS API](https://samuelreichor.at/libraries/js-craftcms-api): This package brings the query builder of craft CMS into the js ecosystem.
You can build wrappers around it to support your framework.

Contributions are welcome! <3

## Support

If you encounter bugs or have feature requests, [please submit an issue](/../../issues/new). Your feedback helps improve the library!

0 comments on commit e1069d5

Please sign in to comment.