Send SMS with node.js and Nexmo API. Useful for
- sms verifications
- sms code generations etc.
-
npm init --> create package.json
set app.js (or whatever) as entry point -
npm install --save express ejs nexmo body-parser socket.io --> install required packages
--> socket.io --> to send a response (a message) to user, once sms sent
--> ejs --> embedded js (for templating, generate HTML with JS) -
npm install -g nodemon --> continously watching for changes and restarting server (install globally)
-
bring required modules to app.js
-
Start server
--> to run the app --> node app or nodemon -
Create route
- all html files resides in a folder named "views"
-
Create UI in index.html
-
Add js folder --> this is where all client side coding goes
- In app.js public folder defined as a Staic.
- Create public folder --> inside that, js folder --> main.js