A simple search engine interface for Ikea products catalogue, which utilizes Import.IO API for data querying.
- Ensure that NodeJS is installed. This provides the platform on which the build tooling runs.
- From the project folder, execute the following command:
npm install
- Ensure that Gulp is installed. If you need to install it, use the following command:
npm install -g gulp
- Ensure that jspm is installed. If you need to install it, use the following command:
npm install -g jspm
Note: jspm queries GitHub to install semver packages, but GitHub has a rate limit on anonymous API requests. It is advised that you configure jspm with your GitHub credentials in order to avoid problems. You can do this by executing
jspm endpoint config github
and following the prompts.
- Install the client-side dependencies with jspm:
jspm install -y
Note: Windows users, if you experience an error of "unknown command unzip" you can solve this problem by doing
npm install -g unzip
and then re-runningjspm install
.
- To run the app, execute the following command:
gulp watch
- Browse to http://localhost:9000 to see the app. You can make changes in the code found under
src
and the browser should auto-refresh itself as you save files.
To run the unit tests, first ensure that you have followed the steps above in order to install all dependencies and successfully build the library. Once you have done that, proceed with these additional steps:
- Ensure that the Karma CLI is installed. If you need to install it, use the following command:
npm install -g karma-cli
- Install Aurelia libs for test visibility:
jspm install aurelia-framework
jspm install aurelia-http-client
jspm install aurelia-router
- You can now run the tests with this command:
karma start
This application utilizes https://github.com/import-io/client-js-mini to query the ImportIO API, and obtain the data about Ikea products. It requires providing your User Guid and API Key to perform the query, as well as the Connector Guid that will be used to search for data. The connector that will be utilized has to first be trained for Ikea data.
I thought about utilizing https://github.com/import-io/client-js to create a standalone application, that doesn't require authentication, and just performs the queries, with backend server for signing them, but there two main problems with that.
- Full client-js library is cumbersome to connect though JSPM, as it doesn't expose the fully built version of the library at the moment, and JSPM by default does not allow script concatenation. It probably could be done by utilizing a Gulp script for scripts concatenation, but second point stopped me from experimenting with it more.
- Because of time constrains I didn't want to create a full blown application, that would allow performing signed queries, as this would require securing the possibility of making unauthorized queries, by authenticating users, or parsing query data on the server side. Instead I wanted to focus on ImportIO API utilization.
There is also a server side express application, that allows signing queries, based on provided userGuid and API Key in the config file. To run this application, first run:
npm install
and next
npm start
This will run the express application at port 3000, and will allow to send POST requests expecting a "query" parameter sent in the body, which will contain the query to be signed. In response it will return the digest constructed after signing the query.