- Express Node.js Framework
- Passport Authentication
- Knex.js SQL query builder
- Objection.js ORM
- MySQL SQL Database
- bcrypt Password hashing function
Install mysql
or mariadb
Get GOOGLE_CLIENT_ID
and GOOGLE_CLIENT_SECRET
from Google Developers Console
Get FACEBOOK_APP_ID
and FACEBOOK_APP_SECRET
from Facebook Developers.
Get SENDGRID_API_KEY
from Sendgrid
- Run:
npm install
to install the dependencies - Create database
- Edit .env
- Run:
npm migrate
to create the tables into the database
- Run:
npm run seed
to insert demo data into the database - Run:
npm run dev
to run server
- Run:
npm run start
to run server
Authorization: Bearer jwt.token.here
Endpoint | HTTP | Description | Body | Return |
---|---|---|---|---|
/auth/signup |
POST | Sign up | email , password |
user |
/auth/signin |
POST | Sign in | email , password |
user, token |
/auth/forgot_password |
POST | Send email including link for reset password page | email |
{ success: true } |
/auth/reset_password |
GET | Redirect to reset password page if token is still valid | - | - |
/auth/reset_password |
POST | Reset passwod | password , token |
user |
/auth/refresh_token |
POST | Refresh JWT token | token |
token |
/auth/google |
GET | Sign in using google | - | - |
/auth/google/callback |
GET | Path that users are redirected to after they have authenticated with Google | - | token |
/auth/facebook |
GET | Sign in using facebook | - | - |
/auth/facebook/callback |
GET | Path that users are redirected to after they have authenticated with Facebook | - | token |
Authentication required
Endpoint | HTTP | Description | Body | Return |
---|---|---|---|---|
/account/ |
GET | Get current user data | - | user |
/account/change_password |
POST | Change current user password | oldPassword , newPassword |
user |
Authentication required
Endpoint | HTTP | Description | Body | Return |
---|---|---|---|---|
/events/ |
GET | Get all events data | - | List of events |
/:eventId |
GET | Get event data by id | - | eventId |
/:eventId/details |
GET | Get event details data by id | - | event details |
/:eventId/join |
POST | Update event data by id | - | { success: true } |
{
"user": {
"id": 6,
"googleId": null,
"facebookId": null,
"name": null,
"email": "Dillon.Johnston@yahoo.com",
"created_at": "2018-08-31T03:15:14.000Z",
"updated_at": "2018-08-31T03:15:14.000Z"
}
}
{
"users": [
{
"id": 1,
"googleId": null,
"facebookId": null,
"name": "Kali Keeling PhD",
"email": "Mercedes_Hamill76@gmail.com",
"created_at": "2018-08-31T03:09:40.000Z",
"updated_at": "2018-08-31T03:09:40.000Z"
},
{
"id": 2,
"googleId": null,
"facebookId": null,
"name": "Mia Roberts V",
"email": "Adah_Quigley47@hotmail.com",
"created_at": "2018-08-31T03:09:40.000Z",
"updated_at": "2018-08-31T03:09:40.000Z"
}
]
}
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NywiZW1haWwiOiJnaWJyYW5raHJpc25hcHV0cmFAZ21haWwuY29tIiwiaWF0IjoxNTM1Njg4MDA2LCJleHAiOjE1MzYyOTI4MDZ9.jwVZHCsGKb6pLlYR--qJlLAlo8zSdK9H7Nc5tlreTXc"
}