Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
209 changes: 209 additions & 0 deletions api-doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
# E-COOMERCE-CMS APPS

List of available endpoints:
- `POST /login`
- `POST /products`
- `GET /products`
- `PUT /products/:id`
- `DELETE /products/:id`


### POST /login
- Request Header
Not required.
- Request Body
```json
{
"email": "[email protected]",
"password": "1234"
}
```
- Response 200: OK
```json
{
"token": "<token>"
}
```
- Response 400: Bad Request
```json
{
"msg": "email or password is incorrect!"
}
```
- Response 500: Internal server error
```json
{
type: "Internal Server Error", <show error>
}
```
### POST /products
- Request Header
```json
{
"accesstoken":"<access token>"
}
```
- Request Body
```json
{
"name": "allmight",
"image_url": "https://www.actionfigurezone.id/wp-content/uploads/2019/06/My-Hero-Academia-Age-of-Heroes-All-Might-2.jpg",
"price": 20000,
"stock": 10
}
```
- Response 200: OK
```json
{
"id": 14,
"name": "allmight",
"image_url": "https://www.actionfigurezone.id/wp-content/uploads/2019/06/My-Hero-Academia-Age-of-Heroes-All-Might-2.jpg",
"price": 20000,
"stock": 10,
"updatedAt": "2020-08-23T02:43:20.068Z",
"createdAt": "2020-08-23T02:43:20.068Z"
}
```

- Response 400: Bad Request
```json
{
"msg": "msg": "Name can't be empty,Price minimum 1,Stock minimum 1"
}
```

- Response 401: Not Authorized
```json
{
"msg": "Not Authorized"
}
```

- Response 500: Internal server error
```json
{
type: "Internal Server Error", <show error>
}
```

### GET /products
- Request Header
```json
{
"accesstoken":"<access token>"
}
```
- Request Body
no needed
- Response 200: OK
```json
[
{
"id": 14,
"name": "allmight",
"image_url": "https://www.actionfigurezone.id/wp-content/uploads/2019/06/My-Hero-Academia-Age-of-Heroes-All-Might-2.jpg",
"price": 20000,
"stock": 10,
"createdAt": "2020-08-23T02:43:20.068Z",
"updatedAt": "2020-08-23T02:43:20.068Z"
}
]
```

- Response 500: Internal server error
```json
{
type: "Internal Server Error", <show error>
}
```

### PUT /products/:id
- Request Header
```json
{
"accesstoken":"<access token>"
}
```
- Request Body
```json
{
"name": "wonderwoman",
"image_url": "https://www.actionfigurezone.id/wp-content/uploads/2019/06/My-Hero-Academia-Age-of-Heroes-All-Might-2.jpg",
"price": 20000,
"stock": 10
}
```
- Response 200: OK
```json
{
"msg": "product update"
}
```

- Response 400: Bad Request
```json
{
"msg": "msg": "Name can't be empty,Price minimum 1,Stock minimum 1"
}
```

- Response 401: Not Authorized
```json
{
"msg": "Not Authorized"
}
```

- Response 500: Internal server error
```json
{
type: "Internal Server Error", <show error>
}
```

### DELETE /products/:id
- Request Header
```json
{
"accesstoken":"<access token>"
}
```
- Request Body
no needed
- Response 200: OK
```json
{
"msg": "product delete"
}
```

- Response 401: Not Authorized
```json
{
"msg": "Not Authorized"
}
```

- Response 500: Internal server error
```json
{
type: "Internal Server Error", <show error>
}
```
3 changes: 3 additions & 0 deletions client/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> 1%
last 2 versions
not dead
5 changes: 5 additions & 0 deletions client/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
17 changes: 17 additions & 0 deletions client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
root: true,
env: {
node: true
},
extends: [
'plugin:vue/essential',
'@vue/standard'
],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
}
}
23 changes: 23 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
24 changes: 24 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# client

## Project setup
```
npm install
```

### Compiles and hot-reloads for development
```
npm run serve
```

### Compiles and minifies for production
```
npm run build
```

### Lints and fixes files
```
npm run lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
5 changes: 5 additions & 0 deletions client/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
Loading