fa2c7f2e8b53250c75d249fa7df041261c908a81
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 and install all necessary packages:
npm i
Test/development
There are multiple commands to test parts or the whole project:
npm run vite:dev: Start Vue frontend onlynpm run server:dev: Start ExpressJs backend onlynpm run fullstack:dev: Start front- and backend
The frontend runs on http://localhost:5173/ and the backend on http://localhost:3000/
Build
npm run vite:build: Build Vue frontend onlynpm run server:build: Build ExpressJs backend onlynpm run fullstack:build: Build front- and backendnpm run electron:build: Build front- and backend to an Electron desktop applicationnpm run builder:build: Build an installer file of the Electron application for current operating system. Electron-build has to run first!npm run builder:win: Build an installer file of the Electron application for Windows operating systems. Electron-build has to run first!
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.
Listing existing
GET /accounts/ (Get all Accounts)
Parameters
None
Responses
http code content-type response 200application/jsonArray<Account + AccountRole>
Example Response
[
{
"id": 421,
"username": "hagemeister93",
"password": "Xjt3qb5t",
"email": "hagemeister93@gmail.com",
"firstName": "Laurin",
"lastName": "Hagemeister",
"accountRoleId": 2,
"accountRole": {
"id": 2,
"name": "Admin",
"privilegeBuy": true,
"privilegeAdminPanel": true
}
}
]
GET /api/files (Get all public files)
Parameters
None
Responses
http code content-type response 200application/jsonArray<{folder: String, files: Array<{name: String, size: Number, url: String}> }>
Example Response
[
{
"folder": "artists",
"files": [
{
"name": "alex-turner.jpg",
"size": 56473,
"url": "http://localhost:3000/static/artists/alex-turner.jpg"
},
{
"name": "andy-nicholson.jpg",
"size": 68983,
"url": "http://localhost:3000/static/artists/andy-nicholson.jpg"
}
]
}
]
GET /bands/ (Get all bands)
Parameters
name type data type description sortoptional string Sort by number of concerts ascending (asc) or descending (desc) countoptional number Number of items to responde
Responses
http code content-type response 200application/jsonArray<>
Example Response
[
{
"folder": "artists",
"files": [
{
"name": "alex-turner.jpg",
"size": 56473,
"url": "http://localhost:3000/static/artists/alex-turner.jpg"
},
{
"name": "andy-nicholson.jpg",
"size": 68983,
"url": "http://localhost:3000/static/artists/andy-nicholson.jpg"
}
]
}
]
GET /events?city=cityName&genre=genreName&count=nrOfItems&sort=sortDirection (Get all events, filtered by city and genre)
Parameters
name type data type description cityNameoptional string Name of the city to filter for genreNameoptional string Name of the genre to filter for nrOfItemsoptional number Limits number of results sortDirectionoptional string Sort by number of concerts, 'asc' or 'desc'
Responses
http code content-type response 200application/jsonArray<Event + Array<Concert + Location + City> + Band & Genre>
GET /locations?count=nrOfItems&sort=sortDirection (Get all locations)
Parameters
name type data type description nrOfItemsoptional number Limits number of results sortDirectionoptional string Sort by number of concerts, 'asc' or 'desc'
Responses
http code content-type response 200application/jsonArray<Location + City + Array<Concert + Event>>
Down here: todo!
GET /bands (Get all bands)
Parameters
None
Responses
http code content-type response 200application/jsonArray<Band>
GET /bands/:id (Get all information about one band)
Parameters
name type data type description idrequired string ID of product in the database
Responses
http code content-type response 200application/jsonBand+Array<Rating>+Array<Member>
GET /shows/:id (Get all information about one show)
Parameters
name type data type description idrequired string ID of product in the database
Responses
http code content-type response 200application/jsonShow+Tour+Location+City
GET /tours (Get all tours)
Parameters
None
Responses
http code content-type response 200application/jsonArray<Tours>+Band+Show+Location+City
GET /genres (Get all genres)
Parameters
None
Responses
http code content-type response 200application/jsonArray<Genre>
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>
GET /brands (Get all Brands)
Parameters
None
Responses
http code content-type response 200application/jsonArray<Brand>
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 /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
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
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
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"}
Languages
Vue
51.1%
TypeScript
48.6%
JavaScript
0.2%
