8395b4427d345df2234717aa3739ddde37c827fd
HackMyCart
The most hackable Web Shop!
How to use
Prepare development environment
- Install node.js
sudo apt install npm
# If outdated version:
sudo npm install -g n
sudo n stable
- Download + extract the project
- Open the root folder with VS Code (recommended)
- Open the bash inside VS Code, navigate to the
software/folder and install all necessary packages:
npm i
Test/development
There are multiple commands to test parts or the whole project:
npm run dev: Starts the Vue frontend onlynpm run server: Starts the ExpressJs backend onlynpm run serve: Starts front- and backend
The frontend runs on http://localhost:5173/ and the backend on http://localhost:3000/
Compile for production
TODO
Structure
Database
Backend API endpoints
The application host it's data in a SQLite database. The access is managed by an ExpressJs server which offers many REST-API endpoints for the frontend. The REST-API server runs on port 3000.
Validate
POST /accounts/login (Login for user)
Parameters
name type data type description username required string Username of the account password required string Password of the account
Responses
http code content-type response 200application/jsonAccountObject+Addresses,Payments,AccountRole400application/json{code: 400, message: "Bad Request"}401application/json{code: 401, message: "Unauthorized"}
Listing existing
GET /products/ (Get all products)
Parameters
None
Responses
http code content-type response 200application/jsonArray<ProductModel>+Category,Brand
GET /products/:id (Get a product by it's id)
Parameters
name type data type description idrequired string ID of product in the database
Responses
http code content-type response 200application/jsonProductModel+Category,Brand
GET /orders/:id (Get all orders of an user)
Parameters
name type data type description idrequired string ID of userAccount in the database
Responses
http code content-type response 200application/jsonProductModel+Order,OrderItem,Product
GET /categories/ (Get all Categories)
Parameters
None
Responses
http code content-type response 200application/jsonArray<Categories>
Creating new
POST /accounts/ (Create a new account)
Parameters
name type data type description None required object (JSON) Model of an Account
Responses
http code content-type response 201application/jsonAccountModel400application/json{code: 400, message: "Username too short!"}400application/json{code: 400, message: "Password too short!"}409application/json{code: 409, message: "Username already in use"}
POST /products/ (Create a new product)
Parameters
name type data type description None required object (JSON) Model of a Product
Responses
http code content-type response 201application/jsonProductModel400application/json{code: 400, message: "..."}
POST /orders/ (Create a new order)
Parameters
name type data type description None required object (JSON) Model of an Order
Responses
http code content-type response 201application/jsonOrderModel
POST /categories/ (Create a new category)
Parameters
name type data type description None required object (JSON) Model of a Category
Responses
http code content-type response 201application/jsonOrderModel400application/json{code: 400, message: "..."}
Updating existing
PATCH /accounts/ (Update data of an existing account)
Parameters
name type data type description None required object (JSON) Model of an Account
Responses
http code content-type response 200application/jsonAccountModel 400application/json{code: 400, message: "..."}
Delete existing
DELETE /product/:id (Delete a product)
Parameters
name type data type description idrequired string ID of product in the database
Responses
http code content-type response 200application/jsonProductModel400application/json{code: 400, message: "..."}
DELETE /categories/:id (Delete a category)
Parameters
name type data type description idrequired string ID of category in the database
Responses
http code content-type response 200application/jsonCategoryModel400application/json{code: 400, message: "..."}
Miscs
GET /api/ (Check if server runs)
Parameters
None
Responses
http code content-type response 200None None
GET /resetDatabase/ (Reset the database to it's default values)
Parameters
None
Responses
http code content-type response 200None None
Languages
Vue
51.1%
TypeScript
48.6%
JavaScript
0.2%
