Walmart product search API using hapi and mongo.
You should have Node 8+ installed and a local MongoDB server running, or have a remote server specified via the MONGO_CONNECTION_STRING environment variable.
npm installBefore starting the API, you must import product data from the Walmart API into your Mongo database. The ./data/import.js script will achieve this. The WALMART_API_KEY environment variable must be specified. For example:
WALMART_API_KEY={yourApiKey} node ./data/import.jsnpm startDefaults can be found in ./config/defaults.json.
HAPI_HOST(optional) - Host on which to run the API.HAPI_PORT(optional) - Port on which to run the API.MONGO_CONNECTION_STRING(optional) - MongoDB connection string
The API has a single endpoint, which returns JSON array of products with descriptions containing the provided keyword. Assuming default configuration, usage is as follows:
GET localhost:3000/products?keyword={yourSearchKeyword}
The keyword query parameter must be provided. It must be at least 1 character, and no more than 128 characters. All characters must be alphanumeric.
npm run lintnpm test