https://github.com/ezsystems/ez-js-rest-client
Javascript REST client for eZ Platform RESTv2 API, mimics PHP API found in eZ Platform.
https://github.com/ezsystems/ez-js-rest-client
Last synced: over 1 year ago
JSON representation
Javascript REST client for eZ Platform RESTv2 API, mimics PHP API found in eZ Platform.
- Host: GitHub
- URL: https://github.com/ezsystems/ez-js-rest-client
- Owner: ezsystems
- License: other
- Created: 2013-07-08T09:36:06.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2018-12-18T15:38:21.000Z (over 7 years ago)
- Last Synced: 2025-04-15T11:44:30.139Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 4.66 MB
- Stars: 6
- Watchers: 27
- Forks: 10
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JavaScript client for the eZ Platform REST API
[](https://travis-ci.org/ezsystems/ez-js-rest-client)
This repository provides a JavaScript library meant to ease the usage of [the eZ
Publish REST API](https://doc.ez.no/display/TECHDOC/REST+API+Tutorials).
## Installation
The eZ Platform JavaScript REST Client is a [bower](http://bower.io) package, so
the easiest way to install it is to run:
```
$ bower install --save ezsystems/ez-js-rest-client
```
Then you can include in your project the file
`bower\_components/ez-js-rest-client/dist/CAPI-min.js` (or the non minified
version). It's also possible to directly take `dist/CAPI.js` or
`dist/CAPI-min.js` in a clone of this repository.
## Usage
The usage the JavaScript REST Client is detailed in [Using the JavaScript REST
API
Client](https://doc.ez.no/display/TECHDOC/Using+the+JavaScript+REST+API+Client)
## Development
### Requirements
The project maintenance is handled in a [nodejs](http://nodejs.org) based
environment with a help of Grunt task runner.
* Install [nodejs](http://nodejs.org/)
* Clone this repository
* From the root of the repository, install the local npm dependencies:
```
$ npm install
```
* Install the global dependencies (usually you need to be root)
```
# npm install -g grunt-cli yuidocjs
```
### API Documentation
The JavaScript API documentation can be generated in the `api` directory with:
```
$ grunt doc
```
Alternatively, you can run
```
$ grunt livedoc
```
to run the [yuidoc documentation
server](http://yui.github.io/yuidoc/args/index.html#server). The dynamic
documentation can then be reached at http://127.0.0.1:3000.
### Build
The library can be built with:
```
$ grunt build
```
This command will (re)generate the files `dist/CAPI.js` and `dist/CAPI-min.js`.
### Tests
#### Unit tests
The unit tests can be executed with:
```
$ grunt test
```
It's also possible to generate a coverage report with:
```
$ grunt coverage
```
After this command, the report is available in
`test/coverage/lcov-report/index.html`.
#### Continuous execution
During development it may be quite handy to automatically rerun unit-tests and/or
lint checks, once any project related file has changed.
Using so called `watch` tasks this can easily be achieved. Currently the following
of those tasks exist:
- `watch:lint`: On each file change execute a linting run
- `watch:test`: Execute a unit-test run on each file change
#### Manual tests
The library can be manually tested by installing the Symfony2 bundle
*jsRestClientBundle*, which is situated in the test/manual/ folder.
Before bundle installation run `grunt build` command once. It will build all the
source files into Resources/public/js/CAPI.js file.
Then the bundle could be installed into your current ezPublish 5.x instance
using following instruction:
* Create `path/to/ezpublish5/src/EzSystems` if it does not exist.
* Symlink the bundle into /src/EzSystems/ (keep folder name).
* Edit /app/AppKernel.php and add the following line before in the
return statement of the method registerBundles:
```php
$bundles[] = new EzSystems\jsRestClientBundle\jsRestClientBundle();
```
* Import routing.yml file of the bundle into main routing file by adding the
following lines at the very bottom of `ezpublish/config/routing.yml`:
```yaml
jsRestClientBundle:
resource: "@jsRestClientBundle/Resources/config/routing.yml"
```
* Clear the Symfony 2 caches with app/console.
After these steps you may access `/js-rest-client-test/` path where you will find
testing html page. Most of requests can be configured a little bit before
executing them by changing input values. See details of tests implementation in
Resources/public/js/cookbook-*.js files.