Skip to content

Commit

Permalink
add RESTFull API Server
Browse files Browse the repository at this point in the history
  • Loading branch information
manh21 committed Mar 3, 2020
1 parent 182bac6 commit 9b31e14
Show file tree
Hide file tree
Showing 67 changed files with 6,101 additions and 6 deletions.
133 changes: 131 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[![Build Status](https://travis-ci.com/manh21/eVoting.svg?branch=master)](https://travis-ci.com/manh21/eVoting)

# eVoting

Aplikasi ini dibuat untuk meningkatkan kesadaran akan pentingnya menggunakan hak pilih kita dalam demokrasi di dunia yang modern ini.
Expand Down Expand Up @@ -40,4 +38,135 @@ Username: 123123
Password: 123123
```

# API

API hanya untuk User Pemilih

**Configuration**
application/config/jwt.php

Rubah JWT Secure Key

```
/*
|--------------------------------------------------------------------------
| JWT Secure Key
|--------------------------------------------------------------------------
*/
$config['jwt_key'] = "Change This";
```

JWT Algorithm Type Options

```
/*
|--------------------------------------------------------------------------
| JWT Algorithm Type
|--------------------------------------------------------------------------
*/
$config['jwt_algorithm'] = 'HS256';
```

Supported JWT Algorithm:

1. HS256
2. HS384
3. HS512

**Login**

```
@param: username
@param: password
--------------------------
@method : POST
@link: localhost/evoting/api/users/login
```

Response:

```
{
"status": true,
"data": {
"userid": "7",
"nama": "DF",
"status": "Sudah Memilih",
"aktif": "1",
"level": "siswa",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjciLCJuYW1hIjoiREYiLCJ1c2VybmFtZSI6IjMzMzMiLCJzdGF0dXMiOiJTdWRhaCBNZW1pbGloIiwiYWt0aWYiOiIxIiwibGV2ZWwiOiJzaXN3YSIsInRpbWUiOjE1ODMxOTk2NTF9.j5rJawQF6vxo6xtEWjV2lAnYSl9mbQe110qijlCPxXw"
},
"message": "User login successful"
}
```

**Data Kandidat**

```
@method : GET
@link: localhost/evoting/api/vote/kandidat
----------------------------------
Use token:
*Authoriztion = Token*
```

Response:

```
{
"status": true,
"data": {
"kandidat_data": [
{
"idkandidat": "6",
"organisasi": "OSIS",
"nama": "OSMANSA",
"nourut": "01",
"jumlahsuara": "2",
"visi": "<p>OSMANSA</p>",
"misi": "<p>OSMANSA</p>",
"foto": "OSMASA.jpg",
"status": "1",
"filefoto": "localhost/assets/uploads/kandidat/OSMASA.jpg"
},
{
"idkandidat": "7",
"organisasi": "MPK",
"nama": "MPK",
"nourut": "02",
"jumlahsuara": "0",
"visi": "<p>MPK</p>",
"misi": "<p>MPK</p>",
"foto": "MPK_VEC.png",
"status": "1",
"filefoto": "localhost/assets/uploads/kandidat/MPK_VEC.jpg"
}
]
},
"message": "Request successful"
}
```

**Vote**

```
@param: idkandidat
@param: idpemilih
--------------------------
@method : POST
@link: localhost/evoting/api/user/login
----------------------------------
Use token:
*Authoriztion = Token*
```

Response:

```
{
"status": true ,
"message": "Vote successfull"
}
```

Jika ada masukan untuk project ini silahkan gunakan fitur issues di github
17 changes: 17 additions & 0 deletions application/config/jwt.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php defined('BASEPATH') or exit('No direct script access allowed');

/*
|--------------------------------------------------------------------------
| JWT Secure Key
|--------------------------------------------------------------------------
*/
$config['jwt_key'] = "-ZSBUXQCx1ZpXX_28ICSM5ckPgLq_C-ZsgdMrb75VWOK8_TNKlmpFUgih4JOr0dk0HXdMhQgSRjzL3Di-8HNpl6amv9Pg9EuhobVqLuDkPvTHXB2QSkWM3ohhucQYAd-1FG6bwFtGS4-4-cXZahcJXq0Wpx-Ywf3X0iNNPd4z4FjKSmKSUAfbrb6N6eA-CUHiN1D_dy93XisZOf5dXQUmKeWfaKvZ8EMw8CKfAFyTONrZCaoRVqd664NASqE1b4XldgSC9J-6R7Jq06nBNRAwdAB6wRhfjVVc_qiMmu9ywl5KSzuYgSfoxyBOxtIjn6YuvFeY5ft75k8hzJ6PKDudA";



/*
|--------------------------------------------------------------------------
| JWT Algorithm Type
|--------------------------------------------------------------------------
*/
$config['jwt_algorithm'] = 'HS256';
Loading

0 comments on commit 9b31e14

Please sign in to comment.