Scaffold (skeleton) code for a web application stack built with Node.js, Express, MongoDB, WebSockets, and block.js. Built for the IEEE CS ticket exchange project, nestor, and much more...
- Copy this repository's contents & change the name
- Remove
package-lock.json
(if it exists) - Update package name (and author) in
package.json
- Update source files
- Rename
app.js
and update path inpackage.json
- Update title in
html/index.html
- Update variables in JS and HTML files
- Replace
{{VARIABLE}}
blocks directly in place with their value - Replace
[[VARIABLE]]
blocks by updating the nearby value
- Replace
- Rename
- Follow the instructions in the following run/test section
- Then remove the test UI in
html/app.block
and test endpoints from each module
- Then remove the test UI in
- Begin building!
- Install/setup Node.js & MongoDB
- Clone this repository
- Install node modules with
sudo npm i
- Ensure the folder
/var/log/mongodb
exists - Ensure ports 8000 & 27017 (or as configured) are unused
- Start MongoDB with configuration
- ie.
mongod --config /home/ubuntu/node-scaffold/mongodb/mongo-prod.conf
- ie.
mongod --config /Users/anuv/Documents/GitHub/node-scaffold/mongodb/mongo-dev.conf
- ie.
- Start Node.js server
- ie.
npm test
ornpm start
- ie.
- Try out CLI example in the node prompt
- ie. in same terminal where script is executing and displaying output, type any of the following commands
testing
ortesting <your_name>
to confirm it is workingmodules
to view the defined available module APIsdb table <collection/table_name>
to query MongoDB for the contents of a tableclear
to clear the consoleexit
orquit
to shut down the server
- Observe which modules produce which specific logging messages, which indicates where the conceptual divisions between modules are
- ie. in same terminal where script is executing and displaying output, type any of the following commands
- Try out web example in a browser
- Go to
http://localhost:8000
- Try out the GET requests & the MongoDB query POST request
- Go to