-
MySQL - There are a lot of relational features in the database like - items related to users, being claimed by other users, etc...
-
Node + Express - I am familiar with this backend framework, so...
-
EJS - My design is card based and has a lot of repeating elements, making either ejs or react a good choice. I chose ejs for this project.
I have tested only on these parameters, although lower resolution is accounted for...
-
Setup NODE and NPM
-
Windows and Mac Users - Go to the following site - https://nodejs.org/en/ Download the current latest stable release and run the installer.
-
Linux Users - run
sudo apt-get install nodejs npm
in terminal to install nodejs and npm directly.
-
-
Copy the project files to a directory of your choice and navigate to the project directory.
-
Install required NPM packages
-
Open your preferred terminal (cmd, system terminal, hyper terminal, vscode terminal, etc) in that folder.
-
Run the command
npm init
on that terminal and just hit enter till the promt is ready again :) -
run the command
npm i package
and replace package with the following one after the other.- express
- ejs
- body-parser
- md5
- multer
- mysql
Alternatively, run
npm i express ejs body-parser md5 multer mysql
on that terminal. It is important this terminal is open in your project folder only.
-
-
Setup MySQL database for the project
- Head over to https://dev.mysql.com/downloads/mysql/ and download the installer for any OS you are running.
- Get the installer for windows or Mac.
- Run
sudo apt install mysql-server
to install followed bysudo mysql_secure_installation
to setup the root account on linux
- Run
mysql --version
to check if MySQL installed successfully. My instructions might be wierd to follow, but you can look-up the documentation on https://dev.mysql.com/doc/mysql-installation-excerpt/8.0/en/ for assistance. - In projectFolder/Reference Docs, you will find an exports.sql file, which is the database. Fetch its path "path"
- On that terminal, run the following commands :
mysql -u root -p
and then enter your passwordcreate database irisrec;
exit
- On terminal, run
mysql -u root -p irisrec < "path/exports.sql"
. Enter the password you setup in step 4.i.b above. Remember to replace the path according to your system as fetched in step 4.iii above. - This will setup my database on your system with following credentials
- user: "root"
- password: <The one you entered in step 4.iv above>
- database: "irisrec" and you need to remember this for a later step.
- Head over to https://dev.mysql.com/downloads/mysql/ and download the installer for any OS you are running.
-
Cool! You have Node, Express, NPM-dependencies and MySQL setup, time for action...
-
Setup project variables
- Open my project folder in your favourite editor (vs-code, atom, etc..)
- Locate the file query.js in root directory. Check the mysql parameters on lines 6-11 and enter your credentials as in step 4.v above.
-
You are all set! Open a terminal in the root directory of the project and run
node server.js
to run the server. You might want to change the listening port on line 21 of server.js to another free port on your computer. Default is 3000. -
On your browser (Chrome, etc..), goto
localhost:3000
to see a page. If it renders, well and good. Otherwise, go through the setup again. You could call me up or reach by WhatsApp, either way! -
If you see hell load of random errors saying "previlage" related "mysql" stuff, do the following..
- Open a new terminal anywhere
- Run the command
sudo mysql -u root -p
and enter your password. - Run the command
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '_yourPasswordHere_';
- Run the command
exit
- Go back to the earlier terminal that you used for step 7 above.
- Hit
ctrl+C
and rerunsudo node server.js
and you should be up and running!
-
The Users on my database have followin id-pwd credentials
- 1-1234
- 2-1234
- 3-1234
-
You shouldn't face any database issues if you import my database as explained in steps above.
-
This database set (in my project folder) represents diversely, all cases of items regarding deadline, costs, bidding, etc.. Feel free to explore!
-
Please check images under Reference Docs > MySQL Verification to verify your database, incase of errors. To do so, run the following commands in a new terminal.
mysql -u root -p
then enter your passworduse irisrec
show tables;
- you should see 2 entriesdesc users;
- check if your terminal output matches with the screenshots I provideddesc items;
- check if your terminal output matches with the screenshots I provided
-
User Dashboard - The user can view items where
- His bid is highest
- The dealine is over and he needs to claim the item
- Items he has uploaded for auction.
-
Add Item Sheet - The user can upload a new item for auction on this page
-
Auction Dashboard - A common space for bidding where all uploaded items within deadline are open for auction followed by an auction archive where past items and highest bidders are seen.
-
A functional navbar and a landing page has been added and the UI is user friendly.
-
Server-wide encryption and .env can be implemented. As of now, my database stores encrypted passwords only with 1 round of hashing.
-
Google signin could be added. But since this is an app for NITK only, it wouldn't make sense if not for additional security tests, which I had no time for.
-
Server side mimetype check for files is limited to .jpg, .jpeg, .png only, although user should technically be able to upload other valid image files.
-
Please ignore the error
Cannot set headers after they are sent to the client
. I am unaware of why it happens, and would love to know! -
The calendar while setting deadline for auction on item accepts past values. But I left it like that only as it is easier for you and me to test myweb-app for old items. So not a bug!