.env file for localhost set up, register for Nodemailer, Stripe, and Pusher.
SECURE_KEY=
NODE_ENV=development
HOST=localhost
USER=
PASS=
DATABASE=
NODEMAILER_HOST=
NODEMAILER_PORT=
NODEMAILER_USER=
NODEMAILER_PASS=
FRONTEND_URL=http://localhost:3000
BACKEND_STRIPE_TOKEN=
PUSHER_APP_ID=
PUSHER_KEY=
PUSHER_SECRET=
PUSHER_CLUSTER=
Postgres setup
- POST
Expects params: user_id (this is needed for authentication)
Expects header :
{
Authorization: jsonWebToken
}
Expects body:
{
"team_name": string,
"wiki": string, //Character limit of 1000
"isPrivate": boolean
}
team_name must be unique
all values are required
Returns the created Team:
{
"id": 1,
"team_name": "labs11",
"wiki": "Labs 11 is the best labs group to date!",
"isPrivate": false,
"created_at": "2019-03-26T20:17:00.543Z",
"updated_at": null
}
- GET
Expects params: user_id (this is needed for authentication)
Expects header :
{
Authorization: jsonWebToken
}
Returns a list of all the Public Teams:
{
teams: [
{
"id": 1,
"team_name": "labs11",
"wiki": "Labs 11 is the best labs group to date!",
"isPrivate": false,
"created_at": "2019-03-26T20:17:00.543Z",
"updated_at": null
},
...
]
}
- GET
Expects params: user_id (this is needed for authentication) and id of the Team
Expects header :
{
Authorization: jsonWebToken
}
Returns the Team:
{
"id": 1,
"team_name": "labs11",
"wiki": "Labs 11 is the best labs group to date!",
"isPrivate": false,
"created_at": "2019-03-26T20:17:00.543Z",
"updated_at": null
}
- PUT
Expects params: user_id (this is needed for authentication) and id of the Team
Expects header :
{
Authorization: jsonWebToken
}
Expects body any team value you want changed:
{
"team_name": string,
"wiki": string, //Character limit of 1000
"isPrivate": boolean
}
example :
{
"wiki": "This was changed"
}
Returns the updated Team:
{
"id": 1,
"team_name": "labs11",
"wiki": "This was changed",
"isPrivate": false,
"created_at": "2019-03-26T20:17:00.543Z",
"updated_at": null
}
- GET
Expects params: user_id (this is needed for authentication) and id of the Team
Expects header :
{
Authorization: jsonWebToken,
order: string,
orderType: asc, desc
}
example :
{
Authorization: jsonWebToken,
order: "name",
orderType: "asc"
}
Returns the team and it's discussions:
{
"team": {
"id": 1,
"team_name": "labs11",
"wiki": "Labs 11 is the best labs group to date!",
"isPrivate": false,
"created_at": "2019-03-26T20:17:00.543Z",
"updated_at": null
},
"discussions": []
}
- GET
Expects params: user_id (this is needed for authentication) and id of the discussion
Expects header :
{
Authorization: jsonWebToken,
order: string,
orderType: asc, desc
}
example :
{
Authorization: jsonWebToken,
order: "name",
orderType: "asc"
}
Returns the discussion with it's posts:
{
"id": 30,
"user_id": 506,
"username": "test",
"team_id": 1,
"team_name": "labs11",
"avatar": "data:image/png;base64,...",
"signature": null,
"body": "This was placed here by me",
"created_at": "1553634012794",
"last_edited_at": null,
"views": 0,
"upvotes": null,
"downvotes": null,
"user_vote": null,
"post_count": 0,
"posts": []
}
- GET
Expects params: user_id (this is needed for authentication) and id of the Team
Expects header :
{
Authorization: jsonWebToken
}
Returns the Team Members:
[
{
"team_id": 1,
"team_name": "labs11",
"user_id": 505,
"username": "lucas",
"role": "team_owner"
}
]
- POST
Expects params: user_id (id of the user joining the Team, same as logged in user) and id of the Team
Expects header :
{
Authorization: jsonWebToken
}
Can also Expect body :
{
team_member_id: number //This is used for another user already apart of a Team to add another User to the Team
}
Returns the newly updated Team members list:
[
{
"team_id": 1,
"team_name": "labs11",
"user_id": 506,
"username": "test",
"role": "member"
}
]
- DELETE
Expects params: user_id (id of the user leaving the Team, same as logged in user) and id of the Team
Expects header :
{
Authorization: jsonWebToken
}
Returns the new Team Members list:
[
{
"team_id": 1,
"team_name": "labs11",
"user_id": 506,
"username": "test",
"role": "member"
}
]
- DELETE
Expects params: user_id (id of the user, same as logged in user) and id of the Team
Expects header :
{
Authorization: jsonWebToken
}
Expects body:
{
team_member_id: number //Id of the user the Team Owner wants to remove from the Team
}
Returns the new Team Members list:
[
{
"team_id": 1,
"team_name": "labs11",
"user_id": 506,
"username": "test",
"role": "member"
}
]