####My Environment
Software | Version |
---|---|
OS | Ubuntu 14.04 |
NodeJS | 4.5 |
MySQL | 5.7 |
Steps to run on your machine:
- Install NodeJS v4.5.0 based on docs
- Install MySQL v5.7 based on docs
- Run
sudo mysql_secure_installation
to secure your existing mysql installation on linux, if you are running another OS, check docs - Install Git based on docs
- Clone this repo
- Run
npm install
at the root directory of repo - Edit
index.js
and add database credentials(create a database in mysql using shell) to it - Run the script
node index.js
, wait for completion - Verify data in the database by running
SELECT * FROM '<tableName>'
, it should return with all the rows, replace<tableName>
with your table's name in the DB. - Run
node api.js
, this make the app server toLISTEN
on port8082
, check if the port is open and not being used by any other app on your machine. - Goto your browser, open URL
http://<server:port>/search/<query>
, it will return with an array of 5 rows from DB, if search results true, else it will return an empty array. If the<query>
is less than 3 characters, it'll returnHTTP 400
bad request.