At the start of a poly semester, you would buy books for modules you are taking and at the end of the semester discard them. You thought it was extremely wasteful to toss away perfectly good books. You found a mobile developer who relates to the same pain and he hands you the following API specs for Snapsell the next day.
-
Create a new MySQL database with the necessary tables with correct use of primary and foreign key constraints
-
Create an Express server that consume data from MySQL using the MySQL library
-
Create an endpoint in the backend
-
to upload images of jpg extension and file size below 1 MB
-
to view own listed products
-
to view offers from other users
-
to add a product listing
-
to search for a specific product
-
to make offer for own product
-
-
Create a frontend using an open-source framework with persistent login and logout
-
Download the zipped files and open them in
Visual Studio Code
. -
Run
npm init
to create newpackage.json
files,npm install
to update and createnode_modules
folder. -
Run
npm install --save axios
,npm install --save bcrypt@3.2.0
,npm install --save cors
,npm install --save dotenv
,npm install --save jsonwebtoken
to install the axios, bcrypt, cors, dotenv and jsonwebtoken packages respectively. -
In VS Code's terminal, type
npm run start-dev
andnodemon index.js
to run the back-end and front-end scripts respectively.
-
Open
MySQLWorkbench
and click onLocal instance MYSQL80 connection
. If you are new, please setup this connection first. -
Once prompted, enter the password set previously before clicking on OK.
-
Create a schema called
bookstore
and double click to make it the working database. -
Open up the files with sql extension to create the necessary tables, such as
img
,likes
,listings
,offers
andusers
. -
Open Postman to insert, update, delete or view the JSON outputs according to the endpoints.
-
Enter
https://localhost:3001/
in the browser to display the index page of SNAPSELL. -
The URL of the other pages are indicated under
CA2 > front-end > index.js
.