https://github.com/amiel/ember-data-url-templates
an ember-addon to allow building urls with url templates instead of defining buildURL
https://github.com/amiel/ember-data-url-templates
addon ember ember-data hacktoberfest
Last synced: 3 months ago
JSON representation
an ember-addon to allow building urls with url templates instead of defining buildURL
- Host: GitHub
- URL: https://github.com/amiel/ember-data-url-templates
- Owner: amiel
- License: mit
- Created: 2015-04-17T21:55:32.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-02-15T14:05:27.000Z (over 2 years ago)
- Last Synced: 2025-03-30T05:09:42.324Z (3 months ago)
- Topics: addon, ember, ember-data, hacktoberfest
- Language: JavaScript
- Homepage: https://github.com/amiel/ember-data-url-templates/wiki
- Size: 1.24 MB
- Stars: 129
- Watchers: 5
- Forks: 22
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ember-data-url-templates
[](https://travis-ci.org/amiel/ember-data-url-templates)
[](http://emberobserver.com/addons/ember-data-url-templates)
[](https://david-dm.org/amiel/ember-data-url-templates)
[](https://david-dm.org/amiel/ember-data-url-templates?type=dev)ember-data-url-templates is an addon to allow building urls with url templates instead of
defining `buildURL` as described in [RFC #4](https://github.com/emberjs/rfcs/pull/4).ember-data-url-templates is under early development. Feedback is welcome, and of course,
so are pull requests.Url templates are compiled with [geraintluff/uri-templates](https://github.com/geraintluff/uri-templates),
which fully implements [RFC 6570](http://tools.ietf.org/html/rfc6570).## Usage
### Installation
```shell
ember install ember-data-url-templates
```### Requirements
ember-data-url-templates `>= 0.1.0` is known to work with ember-data `>= 1.0.0-beta.18`, `^1.13`, and `^2.0`.
### Documentation
More in depth documentation can be found in [the wiki](https://github.com/amiel/ember-data-url-templates/wiki).
### Synopsis
```javascript
// adapters/commentimport Ember from "ember";
import DS from "ember-data";
import UrlTemplates from "ember-data-url-templates";export default DS.RESTAdapter.extend(UrlTemplates, {
urlTemplate: '{+host}/comments{/id}',
queryUrlTemplate: '{+host}/comments{?query*}',
createRecordUrlTemplate: '{+host}/users/{userId}/comments',session: Ember.inject.service(),
urlSegments: {
userId() {
return this.get('session.userId');
}
}
});
```## Contributing
### Installation
* `git clone` this repository
* `npm install`
* `bower install`### Running Tests
* `ember test` or
* `ember test --server`## TODO
Here is a short list of things I'd like to support:
* Use a template provided by the API (like `links`)