Project Description
An application that takes machine learning data and inputs from the user to give reliable percentages of success for a potential Kickstarter project.
1. Created the backend using nodeJS, Express, Knex, MySQLite for development and PostgreSQL for deployment.
2. Took data from the front end and the data machine learning API and parsed it into readable data for the user.
3. Assisted in the front end state management and the construction of the marketing site.
Get User by ID
https://kickstarter-backend.herokuapp.com/api/auth/:id
Get All Users
https://kickstarter-backend.herokuapp.com/api/auth/
Register A User
https://kickstarter-backend.herokuapp.com/api/auth/register
Login A User
https://kickstarter-backend.herokuapp.com/api/auth/login
Change A Password
https://kickstarter-backend.herokuapp.com/api/auth/update/:id
Remove A User
https://kickstarter-backend.herokuapp.com/api/auth/delete/:id
Get A Single Kickstarter by ID
https://kickstarter-backend.herokuapp.com/api/kickstarter/:id
Get A Users Kickstarter by ID
https://kickstarter-backend.herokuapp.com/api/kickstarter/user/:id
Get All Kickstarters
https://kickstarter-backend.herokuapp.com/api/kickstarter/all
Adds a Kickstarter when Given a User_id
https://kickstarter-backend.herokuapp.com/api/kickstarter/user/:id
Update A Single Kickstarter by ID
https://kickstarter-backend.herokuapp.com/api/kickstarter/:id
Removes A Single Kickstarter by ID
https://kickstarter-backend.herokuapp.com/api/kickstarter/:id
If you need to Register a User use the following information.
URL : https://kickstarter-backend.herokuapp.com/api/auth/register
Method : POST
Auth required : NO
Data constraints
{
"username": "[A unique username]",
"password": "[password in plain text]"
}Data example
{
"username": "admin",
"password": "password"
}Code : 201 Created
Content example
The password that is returned is a hash and not a representation of something that you should use.
{
"id": 2,
"username": "[username]",
"password": "93144b288eb1fdccbe46d6fc0f241a51766ecd3d"
}Condition : If 'username' is already taken.
Code : 500 BAD REQUEST
Content :
{
"name": "error",
"length": 212,
"severity": "ERROR",
"code": "23505",
"detail": "Key (username)=([username]) already exists.",
"schema": "public",
"table": "users",
"constraint": "users_username_unique",
"file": "nbtinsert.c",
"line": "534",
"routine": "_bt_check_unique"
}Condition : If 'username' and 'password' combination isn't send.
Code : 500 BAD REQUEST
Content :
{
"error"
}If you need to log a User in use the following information.
URL : https://kickstarter-backend.herokuapp.com/api/auth/login/
Method : POST
Auth required : NO
Data constraints
{
"username": "[valid username]",
"password": "[password in plain text]"
}Data example
{
"username": "admin",
"password": "password"
}Code : 200 OK
Content example
{
"message": "Welcome [username]!",
"token": "93144b288eb1fdccbe46d6fc0f241a51766ecd3d"
}Condition : If 'username' and 'password' combination is wrong.
Code : 401 BAD REQUEST
Content :
{
"message": "Invalid Credentials"
}If you need to change a password use the following information. Use the id of the user that is currently logged in to make the change.
URL : https://kickstarter-backend.herokuapp.com/api/auth/update/:id
Method : PUT
Auth required : YES
Data constraints
{
"username": "[Valid username that has not been changed]",
"password": "[New Password]"
}Data example
{
"username": "admin",
"password": "newPassword"
}Code : 200 OK
Content example
1
Condition : If token isn't valid or you sent an invalid login pair.
Code : 401 Unauthorized
Content :
{
"message": "Invalid Login or Token Expired."
}If you need to change remove a user for any reason.
URL : https://kickstarter-backend.herokuapp.com/api/auth/delete/:id
Method : DELETE
Auth required : YES
Data constraints
{
"username": "[Valid username that has not been changed]",
"password": "[New Password]"
}Data example
{
"username": "admin",
"password": "newPassword"
}Code : 204 No Content
Content example
None
Condition : If token isn't valid or you sent an invalid login pair.
Code : 401 Unauthorized
Content :
{
"message": "Invalid Login or Token Expired."
}If you need to Register a User use the following information.
URL : https://kickstarter-backend.herokuapp.com/api/auth/:id
Method : GET
Auth required : YES
Code : 200 OK
Content example
Grabbing a single User will also give you their kickstarters.
{
"id": 1,
"username": "admin",
"password": "$2a$08$1E8f0RFjlf30c2CL0SRD5eSWJ6EcSvAI5lTsq.GyLacwT8/2iZQkm",
"kickstarter": [
{
"id": 1,
"user_id": 1,
"campaignName": "Test_Project_1",
"categories": "Games",
"description": "Put the decription here and bla bla bla.",
"monetaryGoal": 100000,
"duration": 30,
"country": "USA"
},
{
"id": 2,
"user_id": 1,
"campaignName": "Test_Project_2",
"categories": "Games",
"description": "Put the decription here and bla bla bla.",
"monetaryGoal": 100000,
"duration": 30,
"country": "CHINA"
},
{
"id": 3,
"user_id": 1,
"campaignName": "Test_Project_3",
"categories": "Games",
"description": "Put the decription here and bla bla bla.",
"monetaryGoal": 100000,
"duration": 30,
"country": "RUSSIA"
},
{
"id": 4,
"user_id": 1,
"campaignName": "Test_Project_4",
"categories": "Games",
"description": "Put the decription here and bla bla bla.",
"monetaryGoal": 100000,
"duration": 30,
"country": "JAPAN"
}
]
}Condition : If an incorrect ID is give.
Code : 500 BAD REQUEST
Content : None, Working on that.
Condition : If token isn't valid or you sent an invalid login pair.
Code : 401 Unauthorized
Content :
{
"message": "Invalid Login or Token Expired."
}If you need to Register a User use the following information.
URL : https://kickstarter-backend.herokuapp.com/api/auth/
Method : GET
Auth required : YES
Code : 201 OK
Content example
Grabbing a single User will also give you their kickstarters.
{
[
{
"id": 1,
"username": "admin",
"password": "$2a$08$1E8f0RFjlf30c2CL0SRD5eSWJ6EcSvAI5lTsq.GyLacwT8/2iZQkm"
},
{
"id": 4,
"username": "Test2",
"password": "$2a$08$nauzqJ4ZHsWcPG9148fmS.uBrLE0G3VTJUvVg8FkmxLlQzaFxb3F6"
},
{
"id": 5,
"username": "Test3",
"password": "$2a$08$1tGRKflHEVqEhfJq2lZZn.PM/jcDEYAKNRzcYzmmdUGCaU0IEvsoO"
},
{
"id": 6,
"username": "Test4",
"password": "$2a$08$AIXiylnFh/kJVPxQE15soOQ6fPrFCh99HPeJ04I7I3QHtr/gL0R2e"
}
]
}Condition : If token isn't valid or you sent an invalid login pair.
Code : 401 Unauthorized
Content :
{
"message": "Invalid Login or Token Expired."
}URL : https://kickstarter-backend.herokuapp.com/api/kickstarter/:id
Method : GET
Auth required : YES
Data constraints
{
"username": "[A unique username]",
"password": "[password in plain text]"
}Data example
{
"username": "admin",
"password": "password"
}Code : 201 Created
Content example
The password that is returned is a hash and not a representation of something that you should use.
{
"id": 1,
"user_id": 1,
"campaignName": "Test_Project_1",
"categories": "Games",
"description": "Put the decription here and bla bla bla.",
"monetaryGoal": 100000,
"duration": 30,
"country": "USA"
}Condition : If Token is missing
Code : 401 Unauthorized
Content :
{
"message": "Invalid Login or Token Expired."
}Condition : If an invalid ID is used.
Code : 404 Not Found
Content :
{
"message": "Could not find kickstarters with that ID"
}URL : https://kickstarter-backend.herokuapp.com/api/kickstarter/user/:id
Method : GET
Auth required : YES
Data example
Code : 200 OK
Content example
[
{
"id": 1,
"user_id": 1,
"campaignName": "Test_Project_1",
"categories": "Games",
"description": "Put the decription here and bla bla bla.",
"monetaryGoal": 100000,
"duration": 30,
"country": "USA"
},
{
"id": 2,
"user_id": 1,
"campaignName": "Test_Project_2",
"categories": "Games",
"description": "Put the decription here and bla bla bla.",
"monetaryGoal": 100000,
"duration": 30,
"country": "CHINA"
},
{
"id": 3,
"user_id": 1,
"campaignName": "Test_Project_3",
"categories": "Games",
"description": "Put the decription here and bla bla bla.",
"monetaryGoal": 100000,
"duration": 30,
"country": "RUSSIA"
},
{
"id": 4,
"user_id": 1,
"campaignName": "Test_Project_4",
"categories": "Games",
"description": "Put the decription here and bla bla bla.",
"monetaryGoal": 100000,
"duration": 30,
"country": "JAPAN"
}
]Condition : If Token is missing
Code : 404 Not Found
Content :
{
"message": "Could not find kickstarters with that ID"
}Condition : If Token is missing
Code : 401 Unauthorized
Content :
{
"message": "Invalid Login or Token Expired."
}URL : https://kickstarter-backend.herokuapp.com/api/kickstarter/all
Method : GET
Auth required : YES
Data example
Code : 200 OK
Content example
[
{
"id": 1,
"user_id": 1,
"campaignName": "Test_Project_1",
"categories": "Games",
"description": "Put the decription here and bla bla bla.",
"monetaryGoal": 100000,
"duration": 30,
"country": "USA"
},
{
"id": 2,
"user_id": 2,
"campaignName": "Test_Project_2",
"categories": "Games",
"description": "Put the decription here and bla bla bla.",
"monetaryGoal": 100000,
"duration": 30,
"country": "CHINA"
},
{
"id": 3,
"user_id": 3,
"campaignName": "Test_Project_3",
"categories": "Games",
"description": "Put the decription here and bla bla bla.",
"monetaryGoal": 100000,
"duration": 30,
"country": "RUSSIA"
},
{
"id": 4,
"user_id": 4,
"campaignName": "Test_Project_4",
"categories": "Games",
"description": "Put the decription here and bla bla bla.",
"monetaryGoal": 100000,
"duration": 30,
"country": "JAPAN"
}
]Condition : If Token is missing
Code : 401 Unauthorized
Content :
{
"message": "Invalid Login or Token Expired."
}It is important to look at how the data is sent. You must include a vaid user_id as a part of the data and in the URL request.
URL : https://kickstarter-backend.herokuapp.com/api/kickstarter/user/:id
Method : POST
Auth required : YES
Data constraints
{
"user_id": [an ID that matches an existing user],
"campaignName": [Unique Kickstarter Name],
"monetaryGoal": [Interger],
"description": [String],
"duration": [Interger],
"categories": [String],
"country": [String]
}
Content example
{
"user_id": 5,
"campaignName": "Test_Project_8",
"monetaryGoal": 100000,
"description": "Put the decription here and bla bla bla.",
"duration": "30",
"categories": "Games",
"country": "JAPAN"
}Code : 201 Created
Content example
{
"id": 6,
"user_id": 5,
"campaignName": "Test_Project_8",
"categories": "Games",
"description": "Put the decription here and bla bla bla.",
"monetaryGoal": 100000,
"duration": 30,
"country": "JAPAN"
}Condition : If Invalid user ID is given
Code : 401 Unauthorized
Content :
{
"message": "The UserID that you sent much match the user_id"
}Condition : If Token is missing
Code : 401 Unauthorized
Content :
{
"message": "Invalid Login or Token Expired."
}Updating is just like Posting except that you need to send the KICKSTARTER ID in the URL and not the user you want to attach it to.
URL : https://kickstarter-backend.herokuapp.com/api/kickstarter/:id
Method : PUT
Auth required : YES
Data constraints
{
"user_id": [an ID that matches an existing user],
"campaignName": [Unique Kickstarter Name],
"monetaryGoal": [Interger],
"description": [String],
"duration": [Interger],
"categories": [String],
"country": [String]
}
Content example
0 - [Means nothing was changed]
1 - [Means something was changed]
Condition : If Invalid user ID is given
Code : 404 Not Found
Content :
{
"message": "The UserID that you sent much match the user_id"
}Condition : If Token is missing
Code : 401 Unauthorized
Content :
{
"message": "Invalid Login or Token Expired."
}Updating is just like Posting except that you need to send the KICKSTARTER ID in the URL and not the user you want to attach it to.
URL : https://kickstarter-backend.herokuapp.com/api/kickstarter/:id
Method : DELETE
Auth required : YES
Data constraints
None, just send the request while logged in.
Content example
Condition : If Successful
Code : 204
Condition : If Invalid user ID is given
Code : 404 Not Found
Content :
{
"message": "Kickstarter not found"
}Condition : If Token is missing
Code : 401 Unauthorized
Content :
{
"message": "Invalid Login or Token Expired."
}