Companies nowadays are now turning their businesses online to provide their customers a better experience. One of the most popular e-commerce website we hear often is Ebay – an American multinational company running on Node.js . A lot of folks are suggesting that Node.js might be the future of web development. Node.js is a single-threaded event-driven system that runs fast even when handling lots of requests at once, it is also simple compared to traditional multi-threaded frameworks. Node.js is well suited for real-time applications: online games, collaboration tools, chat rooms, or anything where what one user (or robot?) does with the application needs to be seen by other users immediately, without a page refresh. Using a technique known as “long-polling”, you can write an application that sends updates to the user in real time.
This simple e-commerce application demonstrates CRUD operations using mongoDB and a simple implementation of a session based user authentication using Passport.js. It also utilizes real time update front-end products using socket.io. This web app is 100% free to use, you can customize it to build a more sophisticated e-commerce web application. Feel free to submit an issue on GitHub if you found any bug or even better – submit a pull request.
This web application is currently hosted on Heroku, click here to view the demo. The Heroku testing environment does not support file uploads as their filesystem is readonly. Although you can still test the image upload functionality but all images will be automatically deleted after 30 minutes.
- Products Dashboard
- Add Product
- Edit Product
- Single Product View
- Products View
How do I get setup?
- Create a folder called “data” in the root directory of our nodejs project. This is where MongoDB documents will be stored.
- Go to MongoDB installation directory and under the bin folder run this command: mongod –dbpath C:\Users\Carl\Documents\node-express-mongo\nodetest1\data This will start the MongoDB server. Leave this CLI instance open and start another CLI instance.
- In the new CLI, navigate to where you pulled this repository, ex. C:/nodejs-mongodb-default-template then type-in: npm install then wait till it finishes installing all the modules required to run our Node.js Web Application.
- Once the installation is completed, type in the following command to run our Web Application: npm start Make sure to keep the CLI opened.
- Now go to http://127.0.0.1:3100/ using your favorite browser.
If you are a developer and you would like to contribute to this project, please follow my guidelines bellow:
- ALWAYS start a new branch before making changes to the codes
- Pull requests directly to the master branch will be ignored!
- Use a git client, preferably Source Tree or you can use git commands from your terminal, your choice!
- Many smaller commits are better than one large commit. Edit your file(s), if the edit does not break the code with things like syntax errors, commit. It is easier to reconcile many smaller commits than one large commit.
- When your feature or bug fix is ready, perform a pull request and notify firstname.lastname@example.org that your code is ready for review on Github.