Copy of the problem statement:
- "Create a small demo program in PHP and Nodejs. The program needs to use JS to read all the entries done on the page and whenever a phone number or email is entered by the user it should pick it up and store it in the database.".
- A machine capable of running Apcahe2/httpd, Php, NodeJs, and A latest web-browser.
- fair internet connection as code uses CDNs and databases on clouds.
- Install NodeJs, PHP, and apache2/httpd, start apache2 server on port 80.
- Clone the repo from https://github.com/CodeChari/evolvedemo.git to the document root of apache2
- Run "npm install" in the repo's directory
- run "npm start". it will run node server on port 3000.
- now go to http://YourServerIP/evolvedemo/index.html and test.
- Local SQL, MongoDB installation not required as code is using cloud databases.
- Dump of demo databases i.e. test.sql and test.json are present in the repo.
- There are three dummy fields.
- There are two copies of three input fields in two different tabs.
- Values corresponding to all three of them are stored in a SQL-DB as well as in NoSQL-Document(JSON/BSON).
- PHP is used to store data in SQL and read data from SQL-DB (check the first tab).
- NodeJs is used to Store data to NoSQL DB and read data from NoSQL DB
- An HTML table below input fields shows data from both types of DB in corresponding tabs.
- Whenever a phone number or email is entered, it is saved/updated in the database along with a flag named "type" which tells if it is a phone number or email.
- Anything other than phone and email is not saved in DB.
- node.js - evented I/O for the backend written in JS
- Express - fast node.js network app framework [@tjholowaychuk]
- jQuery - duh
- Twitter Bootstrap - meh
- Php - :)
- MySQL - A Relational Database
- MongoDb - A Non-Relational Database
App requires Node.js v14+ to run.
Install the dependencies and devDependencies and start the server.
$ cd evolvedemo
$ npm install
$ npm start
None
Want to contribute? Great! contact me.
MIT