-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
317 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# Vortex API | ||
|
||
## Table of Contents | ||
* [Authenticate](#authenticate) | ||
+ [Login](#login) | ||
* [User](#user) | ||
+ [Sign Up](#signup) | ||
+ [Sign In](#signin) | ||
+ [Create User](#create-user) | ||
+ [List User](#list-user) | ||
+ [Get User](#get-user) | ||
|
@@ -47,11 +47,52 @@ | |
|
||
|
||
|
||
## Authenticate | ||
## User | ||
|
||
### Signup | ||
|
||
**POST /v1/user/signup** | ||
|
||
No need to give a role, server will assign a "user" role. | ||
|
||
Example: | ||
|
||
```json | ||
{ | ||
"loginCredential":{ | ||
"email":"[email protected]", | ||
"password":"password" | ||
}, | ||
"username":"John Doe", | ||
"firstName":"John", | ||
"lastName":"Doe", | ||
"phoneNumber":"0911111111" | ||
} | ||
``` | ||
|
||
Response Data: | ||
|
||
```json | ||
{ | ||
"id": "5b5b418c760aab15e771bde2", | ||
"uuid": "44b4646a-d009-457c-9fdd-1cc0bf226543", | ||
"jwt": "", | ||
"loginCredential": { | ||
"email": "[email protected]", | ||
"password": "$2a$14$XO4OOUCaiTNQHm.ZTzHU5..WwtP2ec2Q2HPPQuMHP1WoXCjXiRrxa" | ||
}, | ||
"username": "John Doe", | ||
"role": "user", | ||
"firstName": "John", | ||
"lastName": "Doe", | ||
"phoneNumber": "0911111111", | ||
"createdAt": "2018-07-28T00:00:12.632011379+08:00" | ||
} | ||
``` | ||
|
||
### Login | ||
### Signin | ||
|
||
**POST /v1/login** | ||
**POST /v1/users/signin** | ||
|
||
Example: | ||
|
||
|
@@ -71,14 +112,14 @@ Response Data: | |
} | ||
``` | ||
|
||
## User | ||
|
||
### Create User | ||
|
||
**POST /v1/user** | ||
|
||
Example: | ||
|
||
role can only be "root", "user", "guest". | ||
```json | ||
{ | ||
"loginCredential":{ | ||
|
@@ -93,8 +134,6 @@ Example: | |
} | ||
``` | ||
|
||
role can only be "root", "user", "guest" | ||
|
||
Response Data: | ||
|
||
```json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,4 @@ | |
"version": "local", | ||
"logFileName": "access_log" | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/server/core/authenticate.go β src/server/backend/authenticate.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package core | ||
package backend | ||
|
||
import ( | ||
"github.com/linkernetworks/mongo" | ||
|
2 changes: 1 addition & 1 deletion
2
src/server/core/authenticate_test.go β src/server/backend/authenticate_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package core | ||
package backend | ||
|
||
import ( | ||
"math/rand" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package core | ||
package backend | ||
|
||
import ( | ||
"time" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package core | ||
package backend | ||
|
||
import ( | ||
"testing" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package core | ||
package backend | ||
|
||
import ( | ||
"golang.org/x/crypto/bcrypt" | ||
|
2 changes: 1 addition & 1 deletion
2
src/server/core/password_test.go β src/server/backend/password_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package core | ||
package backend | ||
|
||
import ( | ||
"testing" | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.