An app to view and filter transactions stored in a Mongo Database using Express.js and Node.js
Name | USN |
---|---|
Raghu Raj Rai | 01FE16BCS157 |
Nirjar Kulkarni | 01FE16BCS126 |
Nihaal Nandigiri | 01FE16BCS122 |
Himanshu GS | 01FE16BCS078 |
Usage Guide:
- Open the project folder in VisualStudio Code.
- Install Node in the folder to get the Node modules(Not included in the repository due to a 3. large number of files)
- Install Dependencies: (npm install 'name' --save)
- body-parser : To parse the requests sent by the user.
- express : Framework to handle the form requests.
- moment : Efficient for conversion of dates and times to different formats easily.
- mongoose : An Object Relational Mapper(ORM) to communicate with Mongo Server.
- Setup MongoDB:
- Go to the directory where Mongodb is installed and navigate to bin.
- Open command prompt from the explorer(to stay in the same folder) and run the "mongod" command.
- Open another command prompt and run the sequence:
- mongo : To start the mongo shell
- show dbs : See the available databases
- use transactionRecords : Creates and selects a database transactionRecords
- Now we need to add a collection(which is like a table in SQL). We can create a collection by directly adding data to it.
- Run the following command in the command prompt(NOT THE MONGO SHELL) and provide the link of the DUMMY_DATA.json file: mongoimport --db transactionRecords --collection transactions Link to File here with extension without quotes --jsonArray
- Our database is populated now with dummy records.
- We can now run our app. Go to the terminal in VisualStudio Code and run: node mongoserver.js
- The app will be live at "localhost:3000" (Accessed via browser)
- Enter the username: "root" and password: "root"
How to create the dummy records: The dummy data can be created based on your schema on: https://mockaroo.com/ This could be a useful case for testing your database and providing enough records to play around with your filters and features.