Skip to content
/ snapsell Public

πŸ“š A functional website to buy and sell second hand books at a budget price :electron: Developed comprehensive backend functions in JavaScript :shipit: First attempt at coding back-end

License

Notifications You must be signed in to change notification settings

yvki/snapsell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Problem Statement

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.

Supposedly you are an expert backend developer...

  • 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

Installation

  1. Download the zipped files and open them in Visual Studio Code.

  2. Run npm init to create new package.json files, npm install to update and create node_modules folder.

  3. 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.

  4. In VS Code's terminal, type npm run start-dev and nodemon index.js to run the back-end and front-end scripts respectively.

Backend Set-up

  1. Open MySQLWorkbench and click on Local instance MYSQL80 connection. If you are new, please setup this connection first.

  2. Once prompted, enter the password set previously before clicking on OK.

  3. Create a schema called bookstore and double click to make it the working database.

  4. Open up the files with sql extension to create the necessary tables, such as img, likes, listings, offers and users.

  5. Open Postman to insert, update, delete or view the JSON outputs according to the endpoints.

Frontend Set-up

  1. Enter https://localhost:3001/ in the browser to display the index page of SNAPSELL.

  2. The URL of the other pages are indicated under CA2 > front-end > index.js.

About

πŸ“š A functional website to buy and sell second hand books at a budget price :electron: Developed comprehensive backend functions in JavaScript :shipit: First attempt at coding back-end

Topics

Resources

License

Stars

Watchers

Forks