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

Muhamad Fadhil Surya Putra #9

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
253 changes: 252 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,252 @@
# fancy-todo
# fancy-todo
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

biasanya ada di folder server

Copy link
Author

@fadhilsurya fadhilsurya Sep 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PASSWORD="susumurninasional"
JWT_SALT="garam"
GOOGLE_CLIENT_ID="895491504741-7fvkjjp5p3fa3jn3hljfl4juhcrqde4h.apps.googleusercontent.com"
MONGOATLAS=mongodb+srv://fadhilsurya:[email protected]/test?retryWrites=true&w=majority

berikut mas untuk envnya


All the APIs endpoint using base URL:
```javascript
http://localhost:3000
```

## Index of Reference:
* [User]()
* [Todo]()

## User API
| HTTP | Endpoint | Headers | Body | Description |
|--------|----------|---------|------|-------------|
| POST | /user/signup | none | name: string<br>email: string<br>password: string | Register new user |
| POST | /user/signin | none | email: string<br>password: string | Login user |
| POST | /user/signInGoogle | none | log in using user google account | Login user |

## Todo API
| HTTP | Endpoint | Headers | Body | Description |
|--------|----------|---------|------|-------------|
| GET | /todo | {token: JWT token} | none | get user todo list |
| POST | /todo| {token: JWT token} | todo : string<br>description : string<br>dueDate : date | create todo list |
| GET | /todo/search | {token: JWT token, id : userId, todo : string} | none | find user todo and display |
| GET | /todo/:id | {token: JWT token, id:todoId} | none | find user todo for to be display for update requirements |
| PUT | /todo/:id | {token: JWT token, id : todoId} | {todo :string, description :string, dueDate :date} | update todo that matches with |
| DELETE | /todo/:id | {token: JWT token, id : userId} | none | get global published articles |

# Request & Response Details

## User
+ ### Register
method: `POST`<br>
endpoint: `/user/signup`

#### _Request_ :
* body:
```javascript
name: String, required
email: String, required
password: String, required
```

#### _Response_ :
- 201
```javascript
{code: 201, message: "Berhasil SignUp"}

```
- 400
```javascript
{
"code": 400,
"message": "Mohon Maaf Nama Harus di Isi"
}
```

+ ### Login
method: `POST`<br>
endpoint: `/users/login`

#### _Request_ :
* body:
```javascript
email: String, required
password: String, required
```

#### _Response_ :
- 200
```javascript
Get an access token (JWT Token)
{token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1Z…DIxfQ.rCDMqKOnNie3UktVbTbwayGzUiN3_SoHT6qlk15RYvI"}
```
- 401
```javascript
{"code":401,"message":"Mohon Maaf Password Salah"}
```

## Todo
+ ### find all Todo
method: `GET`<br>
endpoint: `/todo`

#### _Request_ :
* body:
```javascript
todo: "foo",
desc: "bar,
due_date: "2019-10-10",
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJiYWR1IiwiZW1haWwiOiJiYWR1QG1haWwuY29tIiwiaWF0IjoxNTY0OTkzNzgxfQ.Q4JKT7BRNCPOGUgTF-9NQTU2YASPRg7a3kO72fpPRY8
```

#### _Response_ :
- 201
```javascript
status: false,
_id: 5d757aed076a72e08de1817e,
userId: 5d757585076a72e08de1817b,
todo: 'cemilan',
description: 'macaroni maicih',
dueDate: 2019-09-16T00:00:00.000Z,
createdAt: 2019-09-08T22:04:29.632Z,
updatedAt: 2019-09-08T22:04:29.632Z
```
- 400
```javascript
{
"code": 403
}
```

+ ### create Todo
method: `POST`<br>
endpoint: `/todo`

#### _Request_ :
* body:
```javascript
todo: 'halooo',
description: 'asfqwreqwr',
dueDate: '2019-09-10'
```

#### _Response_ :
- 201
```javascript
createdAt: "2019-09-08T23:21:52.329Z"
description: "asfqwreqwr"
dueDate: "2019-09-10T00:00:00.000Z"
status: false
todo: "halooo"
updatedAt: "2019-09-08T23:21:52.329Z"
userId: "5d757585076a72e08de1817b"
_id: "5d758d10a528cb008eb62228"
```
- 400
```javascript
{
"code": 401
}
```
+ ### create Todo
method: `POST`<br>
endpoint: `/todo`

#### _Request_ :
* body:
```javascript
todo: 'halooo',
description: 'asfqwreqwr',
dueDate: '2019-09-10'
```

#### _Response_ :
- 201
```javascript
createdAt: "2019-09-08T23:21:52.329Z"
description: "asfqwreqwr"
dueDate: "2019-09-10T00:00:00.000Z"
status: false
todo: "halooo"
updatedAt: "2019-09-08T23:21:52.329Z"
userId: "5d757585076a72e08de1817b"
_id: "5d758d10a528cb008eb62228"
```
- 400
```javascript
{
"code": 401
}
```
+ ### search Todo
method: `GET`<br>
endpoint: `/todo/search`

#### _Request_ :
* body:
```javascript
{todo: todo}
```

#### _Response_ :
- 201
```javascript
createdAt: "2019-09-08T23:12:41.959Z"
description: "suryaaa"
dueDate: "2019-09-23T00:00:00.000Z"
status: false
todo: "fadhil"
updatedAt: "2019-09-08T23:12:41.959Z"
userId: "5d757585076a72e08de1817b"
_id: "5d758ae9560c27fb8b3141e0"
```
- 403
```javascript
{
"code": 403
}
```

+ ### update Todo
method: `PUT`<br>
endpoint: `/todo/:id`

#### _Request_ :
* body:
```javascript
{id: todoId}
```

#### _Response_ :
- 201
```javascript
n: 1
nModified: 1
ok: 1
```
- 403
```javascript
{
"code": 401
}
```
+ ### delete Todo
method: `DELETE`<br>
endpoint: `/todo/:id`

#### _Request_ :
* body:
```javascript
{id: todoId}
```

#### _Response_ :
- 201
```javascript
n: 1
nModified: 1
ok: 1
```
- 403
```javascript
{
"code": 401
}
```





14 changes: 14 additions & 0 deletions client/css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
body {
min-height: 100vh;
position: relative;
margin: 0;
}

footer {
position: absolute;
bottom: 0;
}

thead {
background-color: grey;
}
115 changes: 115 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="https://apis.google.com/js/platform.js" async defer></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous">
</script>
<meta name="google-signin-client_id"
content="895491504741-7fvkjjp5p3fa3jn3hljfl4juhcrqde4h.apps.googleusercontent.com">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="./css/main.css">



<title>Fadhil Todos</title>
</head>

<body>
<!-- INI BAGIAN NAVBARNYA -->
<div class="navbarout" id="navbarTokenFalse">

<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="#">Simple Todo</a>


<div class="btn-group ml-auto ">
<form action="" class="mr-5 formbar">
<input type="text" placeholder="search" name="search" class="searchbar" id="search">
<button type="submit" id="submitsearch" class="searchButton"
style="border-radius: 10%">Submit</button>

</form>
<!-- <a href="#" onclick="signOut();" class="btn btn-outline-warning ml-2 rounded-lg">Sign out</a> -->
<a href="#" onclick="signOut();" id="logOut" class="btn-logout">Sign out</a>
<a href="" id="login" class="signin-form btn btn-login ml-4 " style="color: white">Sign In</a>
<a href="" id="home" class="btn btn-warning ml-4 home-btn">Home</a>
</div>

</div>


<div class="todo-form">
</div>
<!-- INI ISINYA -->
<div class=" container homepage mt-5">
<div class="banner-outer register-form align-items-center col-5">
<div class="banner-inner">
<h1 class="welcome-register">Welcome to Fancy Todo</h1>
<h2 class="motto">ready to Organized your life?</h2>
<form action="">
<table>
<tr>
<td>Name</td>
<td><input type="text" name="name" id="name" placeholder="your username" required>
</td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="email" id="email" placeholder="your email" required>
</td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" id="password" placeholder="your password"
required>
</td>
</tr>
</table>
<br>
<div class="btn-group ml-3">
<a href="" class="btn-register btn btn-success">Register</a>
<div class="g-signin2 signin" data-onsuccess="onSignIn"></div>

</div>


<br>
</form>
<br>


</div>
</div>
</div>


<div id="otherLogin">


</div>

<!-- script -->

<script src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="./index.js"></script>


<div class="d-flex justify-content-center">
<footer class="page-footer font-small blue ">
<div class=" footer-copyright text-center py-3">© 2019 Copyright:
<a href="https://mdbootstrap.com/education/bootstrap/"> fadhilsurya</a>
</div>
</footer>
</div>

</body>

</html>
Loading