Unit 2 and Unit 3 team work
Base URL for deployed API(updating...): https://bw-rw-funding.herokuapp.com/
| Method | URL | Description | Requires Token | Requires Admin |
|---|---|---|---|---|
| POST | /api/auth/register | register a new user | - | - |
| POST | /api/auth/login | login as existing user | - | - |
| POST | /api/ | create a new project | X | - |
| GET | /api/projects | get information of all projects | X | - |
| GET | /api/projects/:id | gets a specific project by id | X | - |
| PUT | /api/projects/:id | edit a project | X | X |
| DELETE | /api/projects/:id | delete a project from database | X | X |
| Name | Type | Required | Unique | Notes |
|---|---|---|---|---|
| id | integer | yes | yes | auto generated by the API |
| firstname | string | yes | yes | - |
| lastname | string | yes | yes | - |
| password | string | yes | no | - |
| role | boolean | no | no | 0 or 1 is the same as false and true, you can use either |
| Name | Type | Required | Unique | Notes |
|---|---|---|---|---|
| project_id | integer | yes | yes | auto generated by the API |
| project_name | string | yes | yes | |
| project_founder | string | yes | yes | - |
| project_description | text | yes | no | information about this project |
| project_goal | decimal | yes | no | - |
| Name | Type | Required | Unique | Notes |
|---|---|---|---|---|
| project_id | integer | yes | yes | auto generated by the API |
| funding_id | integer | yes | yes | auto generated by the API |
| project_name | string | yes | yes | |
| project_description | text | yes | no | information about this project |
| project_raised | decimal | yes | no | - |
---Request Body
{
"firstname": "Evie",
"lastname": "Levie",
"password": "passwords"
}
---Return
{
"message": "Welcome! Your account sucessfully registered",
"data": {
"user_id": 25,
"firstname": "Evie",
"lastname": "Levie",
"password": "$2a$08$Zvy5EH/BKN28kspTTkzLyeS6ikjuoKBA8NRgCNIHGGHWyF8HvnP1q",
"role": 0
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoyNSwiZmlyc3RuYW1lIjoiRXZpZSIsImxhc3RuYW1lIjoiTGV2aWUiLCJpYXQiOjE2MDMwNDg2OTEsImV4cCI6MTYwMzA5MTg5MX0.FQu8UVtAsLvhHr-vtj1w1gkfz9QGoLAxSGNYOwV_vxE"
}
---Request body
{
"firstname": "Evie",
"lastname": "Levie",
"password": "passwords"
}
--- Return
{
"message": "Welcome, it's Virtual Reality Funding Platform ",
"user": {
"user_id": 22,
"firstname": "Evie",
"lastname": "Levie",
"password": "$2a$08$98dK8S27AlD4/IxC8QhPTezhbeEzY2hgjVd2zS6gr0Ui.aItaeaH2"
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoyMiwiZmlyc3RuYW1lIjoiRXZpZSIsImxhc3RuYW1lIjoiTGV2aWUiLCJpYXQiOjE2MDMwNDg5NTMsImV4cCI6MTYwMzA5MjE1M30.Z8AlXbDQ55g2eGkys0NJ0m-5FTy700qwlGCx_JRcs1k"
}
--- Request
Headers
| Key | | Value |
|Authorization| | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. eyJyb2xlIjoyMiwiZmlyc3RuYW1lIjoiRXZpZSIsImxhc3RuYW1lIjoiTGV2aWUiLCJpYXQiOjE2MDMwNDg5NTMsImV4cCI6MTYwMzA5MjE1M30.Z8AlXbDQ55g2eGkys0NJ0m-5FTy700qwlGCx_JRcs1k |
--- Return
[
{
"id": 1,
"project_id": 1,
"project_name": "Astro App - Translate Sign Language ",
"project_founder": "Astrofolic",
"project_description": "What do you write in a Astro project description",
"project_goal": "$10,000.00"
},
{
"id": 2,
"project_id": 2,
"project_name": "Stark App - Healthcare",
"project_founder": "Molasses",
"project_description": "What do you write in Stark project description",
"project_goal": "$20,000.00"
},
{
"id": 3,
"project_id": 3,
"project_name": "Skyhawks App - Virtual Assistant ",
"project_founder": "Dexstrose",
"project_description": "What do you write in Skyhawks project description",
"project_goal": "$30,00.00"
},
{
"id": 4,
"project_id": 4,
"project_name": "Project X App - Travel Vision ",
"project_founder": "Iron",
"project_description": "What do you write in Project X project description",
"project_goal": "$35,00.00"
},
{
"id": 5,
"project_id": 5,
"project_name": "Cascade App- Virtual Shopping",
"project_founder": "Benja",
"project_description": "What do you write in Cascade project description ",
"project_goal": "$40,00.00"
}
]
--- Request
Headers
| Key | | Value |
|Authorization| | 'valid token here' |
--- Return
{
"message": "This is information of project with specific ID",
"project": {
"id": 4,
"project_id": 4,
"project_name": "Project X App - Travel Vision ",
"project_founder": "Iron",
"project_description": "What do you write in Project X project description",
"project_goal": "$35,00.00"
}
}
---Request
---Return
---Request
{
"id": 3,
"project_id": 3,
"project_name": "Phoenix App Solar Energy Test",
"project_founder": "Sophiet",
"project_description": "What do you write in Phoenix project description Test",
"project_goal": "$5,800.00"
}
---Return
{
"success": "Project information is updated",
"id": 3,
"project_id": 3,
"project_name": "Phoenix App Solar Energy Test",
"project_founder": "Sophiet",
"project_description": "What do you write in Phoenix project description Test",
"project_goal": "$5,800.00",
"UpdatingInformation": 1
}
---Request
---Return
---Return
{
"message": "This is funding information",
"res": [
{
"id": 1,
"funding_id": 1,
"project_id": 1,
"project_name": "Astro App - Translate Sign Language ",
"project_description": "What do you write in a Astro project description",
"project_raised": "$2,670.00"
},
{
"id": 2,
"funding_id": 2,
"project_id": 2,
"project_name": "Stark App - Healthcare",
"project_description": "What do you write in Stark project description",
"project_raised": "$5,645.00"
},
{
"id": 3,
"funding_id": 3,
"project_id": 3,
"project_name": "Skyhawks App - Virtual Assistant ",
"project_description": "What do you write in Skyhawks project description",
"project_raised": "$6,234.00"
},
{
"id": 4,
"funding_id": 4,
"project_id": 4,
"project_name": "Project X App - Travel Vision ",
"project_description": "What do you write in Project X project description",
"project_raised": "$7,314.00"
},
{
"id": 5,
"funding_id": 5,
"project_id": 5,
"project_name": "Cascade App- Virtual Shopping",
"project_description": "What do you write in Cascade project description ",
"project_raised": "$8,285.00"
}
]
}
---Request
---Return
projects = [ {
id: 1,
project_id: 1,
project_name: "Astro App - Translate Sign Language ",
project_founder: "Astrofolic",
project_description: "What do you write in a Astro project description",
project_goal: "$10,000.00",
},
]
funding = [
{
id: 1,
funding_id: 1,
project_id: 1,
project_name: "Astro App - Translate Sign Language ",
project_description: "What do you write in a Astro project description",
project_raised: "$2,670.00"
}
]
const users = [
{
firstname: "",
lastname: "",
password:"",
role: 1,
},
];