Skip to content

About

an ember-addon to allow building urls with url templates instead of defining buildURL

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

ember-data-url-templates

Build Status

ember-data-url-templates is an addon to allow building urls with url templates instead of defining buildURL as described in RFC #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, which fully implements RFC 6570.

Usage

Installation

ember install ember-data-url-templates
ember generate ember-data-url-templates

Requirements

ember-data-url-templates makes use of a few features in ember-data that are still in canary (1.0.0-beta.17+canary). Namely:

Synopsis

// adapters/comment

import DS from "ember-data";
import UrlTemplates from "ember-data-url-templates";

extend default DS.RESTAdapter(UrlTemplates, {
  findUrlTemplate: '{+host}/comments/{id}',
  urlTemplate: '{+host}/posts/{postId}/comments{/id}'
});

findQuery

The entire query from findQuery can be included in the url with {?query*}.

findQueryUrlTemplate: '/posts{?query*}'

Or, selective keys from findQuery can be used in the url.

findQueryUrlTemplate: '/blog/{category}{/year,month}'

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:

  • Optionally specify a template for each requestType
  • Use a template provided by the API (like links)
  • Use the query from findQuery to fill the template

About

an ember-addon to allow building urls with url templates instead of defining buildURL

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages