-
Notifications
You must be signed in to change notification settings - Fork 5
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
30 changed files
with
1,116 additions
and
96 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,3 +1,12 @@ | ||
{ | ||
"presets": ["@babel/preset-env"] | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": "current" | ||
} | ||
} | ||
], | ||
] | ||
} |
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 |
---|---|---|
|
@@ -47,8 +47,6 @@ | |
} | ||
} | ||
], | ||
"parserOptions": { | ||
"sourceType": "module" | ||
} | ||
"parserOptions": 0 | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"prettier.eslintIntegration": true | ||
} |
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 |
---|---|---|
@@ -0,0 +1,119 @@ | ||
module.exports = { | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Connection | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Connection to be used for sending emails. Each connection needs to | ||
| define a driver too. | ||
| | ||
*/ | ||
connection: process.env.MAIL_CONNECTION || 'smtp', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Views | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This configuration defines the folder in which all emails are stored. | ||
| If it's not defined, /mails is used as default. | ||
| | ||
*/ | ||
views: 'mails', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| View engine | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This is the view engine that should be used. The currently supported are: | ||
| handlebars, edge | ||
| | ||
*/ | ||
viewEngine: 'handlebars', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| SMTP | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here we define configuration for sending emails via SMTP. | ||
| | ||
*/ | ||
smtp: { | ||
driver: 'smtp', | ||
pool: true, | ||
port: process.env.SMTP_PORT || 2525, | ||
host: process.env.SMTP_HOST || 'smtp.mailtrap.io', | ||
secure: false, | ||
auth: { | ||
user: process.env.MAIL_USERNAME, | ||
pass: process.env.MAIL_PASSWORD | ||
}, | ||
maxConnections: 5, | ||
maxMessages: 100, | ||
rateLimit: 10 | ||
}, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| SparkPost | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here we define configuration for spark post. Extra options can be defined | ||
| inside the "extra" object. | ||
| | ||
| https://developer.sparkpost.com/api/transmissions.html#header-options-attributes | ||
| | ||
| extras: { | ||
| campaign_id: 'sparkpost campaign id', | ||
| options: { // sparkpost options } | ||
| } | ||
| | ||
*/ | ||
sparkpost: { | ||
driver: 'sparkpost', | ||
// endpoint: 'https://api.eu.sparkpost.com/api/v1', | ||
apiKey: process.env.SPARKPOST_API_KEY, | ||
extras: {} | ||
}, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Mailgun | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here we define configuration for mailgun. Extra options can be defined | ||
| inside the "extra" object. | ||
| | ||
| https://mailgun-documentation.readthedocs.io/en/latest/api-sending.html#sending | ||
| | ||
| extras: { | ||
| 'o:tag': '', | ||
| 'o:campaign': '',, | ||
| . . . | ||
| } | ||
| | ||
*/ | ||
mailgun: { | ||
driver: 'mailgun', | ||
domain: process.env.MAILGUN_DOMAIN, | ||
apiKey: process.env.MAILGUN_API_KEY, | ||
extras: {} | ||
}, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Ethereal | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Ethereal driver to quickly test emails in your browser. A disposable | ||
| account is created automatically for you. | ||
| | ||
| https://ethereal.email | ||
| | ||
*/ | ||
ethereal: { | ||
driver: 'ethereal' | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Hi {{name}}. Welcome To Author's Haven. | ||
|
||
Please click on this <a href={{ url }} =>link</a> to confirm your email. |
Empty file.
Empty file.
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { | ||
loginService, | ||
signUpService, | ||
isUserExist | ||
} from '../services/auth.service'; | ||
import Helper from '../services/helper'; | ||
|
||
const signUp = async (request, response) => { | ||
try { | ||
const result = await isUserExist(request.body.email.toLowerCase()); | ||
if (result) { | ||
return Helper.failResponse(response, 409, { | ||
message: 'user already exists' | ||
}); | ||
} | ||
|
||
const value = await signUpService(request.body); | ||
return Helper.successResponse(response, 201, value.user); | ||
} catch (error) { | ||
return Helper.errorResponse(response, 500); | ||
} | ||
}; | ||
|
||
const login = async (request, response) => { | ||
const value = await loginService(request.body); | ||
if (value) { | ||
return Helper.successResponse(response, 200, value.user); | ||
} | ||
return Helper.failResponse(response, 400, { | ||
message: 'Invalid email/password' | ||
}); | ||
}; | ||
|
||
export default { signUp, login }; |
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
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.