Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lalu Oldi Alfitra #11

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
# hacktivoverflow
# hacktivoverflow


## Questions Route
**Note:** * *is required*
HTTP | Router | Headers | Body | Success | Error | Description
------|--------|---------|------|---------|-------|------------
POST | <span style="color:red">/questions</span> | token | *title, *description, *userId | new Question -> Object{id, title, description, upvote, downvote, comment, createdAt, userId} | Object { message: `Internal Server Error`, err } | Create a Question
GET | <span style="color:red">/questions</span> | | | Object{id, title, description, upvote, downvote, comment, createdAt, userId} | Object { message: `Internal Server Error`, err } | All Question
DELETE | <span style="color:red">/questions/:id</span> | token | | Deleted Question -> Object{id, title, description, upvote, downvote, comment, createdAt, userId} | Object { message: `Internal Server Error`, err } | Delete a Question
PUT | <span style="color:red">/questions/:id</span> | token | title, description | Updated Question -> Object{id, title, description, upvote, downvote, comment, createdAt, userId} | Object { message: `Internal Server Error`, err } | Update a Question
GET | <span style="color:red">/questions/:id</span> | token | | Object{id, title, description, upvote, downvote, comment, createdAt, userId} | Object { message: `Internal Server Error`, err } | Get a Question
PUT | <span style="color:red">/questions/upvote/:id</span> | token | userId | Updated Question -> Object{id, title, description, upvote, downvote, comment, createdAt, userId} | Object { message: `Internal Server Error`, err } | Upvote a Question
PUT | <span style="color:red">/questions/downvote/:id</span> | token | userId | Updated Question -> Object{id, title, description, upvote, downvote, comment, createdAt, userId} | Object { message: `Internal Server Error`, err } | Downvote a Question

<br>

## Users Route
**Note:** * *is required*
HTTP | Router | Body | Success | Error | Description
------|--------|------|---------|-------|------------
POST | <span style="color:red">/users/login</span> | *email, *password | Object{token} | Object { message: `Internal Server Error`, err } | Login User
POST | <span style="color:red">/users/register</span> | *email, *password | Object{email, password, role} | Object { message: `Internal Server Error`, err } | Register User

<br>

## Answers Route
**Note:** * *is required*
HTTP | Router | Headers | Body | Success | Error | Description
------|--------|---------|------|---------|-------|------------
POST | <span style="color:red">/answers</span> | token | *title, *description, *userId | new Answer -> Object{id, title, description, upvote, downvote, createdAt, userId} | Object { message: `Internal Server Error`, err } | Create a Answer
GET | <span style="color:red">/answers</span> | token | | Object{id, title, description, upvote, downvote, createdAt, userId} | Object { message: `Internal Server Error`, err } | All Answer
DELETE | <span style="color:red">/answers/:id</span> | token | | Deleted Answer -> Object{id, title, description, upvote, downvote, createdAt, userId} | Object { message: `Internal Server Error`, err } | Delete a Answer
PUT | <span style="color:red">/answers/:id</span> | token | title, description | Updated Answer -> Object{id, title, description, upvote, downvote, createdAt, userId} | Object { message: `Internal Server Error`, err } | Update a Answer
GET | <span style="color:red">/answers/:id</span> | token | | Object{id, title, description, upvote, downvote, createdAt, userId} | Object { message: `Internal Server Error`, err } | Get a Answer
PUT | <span style="color:red">/answers/upvote/:id</span> | token | userId | Updated Answer -> Object{id, title, description, upvote, downvote, createdAt, userId} | Object { message: `Internal Server Error`, err } | Upvote a Answer
PUT | <span style="color:red">/answers/downvote/:id</span> | token | userId | Updated Answer -> Object{id, title, description, upvote, downvote, createdAt, userId} | Object { message: `Internal Server Error`, err } | Downvote a Answer

## Usage

Make sure you have Node.js and npm installed in your computer, and then run these commands:<br>
$npm install<br>
$nodemon app.js<br>
$npm run serve<br>

Access the Server side via http://localhost:5000/.

Access the Client side via http://localhost:8080/.
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 ie <= 8
7 changes: 7 additions & 0 deletions client/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100
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/airbnb',
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
},
parserOptions: {
parser: 'babel-eslint',
},
};
21 changes: 21 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist

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

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

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

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

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

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

### Run your tests
```
npm run test
```

### 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/app',
],
};
Loading