Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use this? #20

Open
clapas opened this issue Dec 24, 2019 · 1 comment
Open

How to use this? #20

clapas opened this issue Dec 24, 2019 · 1 comment

Comments

@clapas
Copy link

clapas commented Dec 24, 2019

Hello,

I'm trying to figure out how to use this.

I installed the rest-api package with bower and added this to my index.html:

<rest-api url="http://localhost:3000">
  <rest-api-resource name="products" collection="{{products}}"></rest-api-resource>
</rest-api>

and this to my index.js:

import 'bower_components/webcomponentsjs/webcomponents-lite'

I am using webpack to serve the app. The elements render but nothing happens, e.g. no API request, etc.

Am I missing any steps? Thanks.

@platosha
Copy link
Owner

platosha commented Jan 8, 2020

@clapas Hi, thanks for trying.

This component is based on HTML Imports. Apart from the webcomponents-lite polyfill, you have to import the rest-api and rest-api-resource components as well in your index.html:

<link rel="import" href="bower_components/rest-api/rest-api.html">
<link rel="import" href="bower_components/rest-api/rest-api-resource.html">

After the successful import, it should start making API requests, e. g., to http://localhost:3000/products.

The import step is unfortunately missing in README, sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants