Toolio REST API
A REST search API that takes in a keyword and returns the list of products that have titles containing the keyword from Toolio Shopify Store.
Heroku:
https://boiling-peak-68713.herokuapp.com
Installation
Fork Repository
$ git clone git@github.com:<username>/toolio.git
Configuration
The .env
file includes some important configuration settings. That's why you should create a new .env
file in project. You can set these configurations if you need but now you can use the below config directly.
Keys: PORT
, API_KEY
, API_URL
, PROTOCOL
PORT = 3000
API_KEY =
PASSWORD =
API_URL = toolio-retail.myshopify.com
PROTOCOL = https
In Heroku, you can set easily using CLI or Heroku UI.
Dependencies
Using yarn:
$ yarn
Using npm:
$ npm install
Development Mode
$ npm run dev
Production Mode
$ npm run build
TDD
To run the tests:
npm run test
Project Structure
├── src
│ ├── routes
│ │ ├── products
│ │ │ ├── products.route.test.ts
│ │ │ ├── products.route.ts
│ │ │ ├── products.service.test.ts
│ │ │ └── products.service.ts
│ │ └── index.ts
│ ├── toolio
│ │ ├── mocks
│ │ │ └── products.json
│ │ ├── common.ts
│ │ └── store.ts
│ ├── app.ts
│ ├── config.ts
│ └── server.ts
├── README.md
├── jest.config.js
├── nodemon.json
├── package.json
└── tsconfig.json
Endpoint List
HTTP | Route | QueryString | Description |
---|---|---|---|
GET |
/ | title | Get a searched producuts list by title. |
Get List Products By Title
Request
GET /?title=Awesome
curl -i -H 'Accept: application/json' http://localhost:3000\?title\=Awesome
Response
HTTP/1.1 200 OK
X-Powered-By: Express
Access-Control-Allow-Origin: *
Content-Type: application/json; charset=utf-8
Content-Length: 121
ETag: W/"79-C2VbBqPEY1dDxzaZFZhmxTK2soI"
Date: Mon, 14 Dec 2020 08:25:20 GMT
Connection: keep-alive
{"products":[{"id":4348174598204,"title":"Awesome Aluminum Gloves"},{"id":4348123971644,"title":"Awesome Aluminum Hat"}]}