Email Reply Application
- Node.js and npm (Node Package Manager)
- Angular CLI: Install it by running
npm install -g @angular/cli
. - PostgreSQL: Follow this guide to install and setup PostgreSQL: PostgreSQL Tutorial
- Docker: Follow this guide to install Docker:Docker Installation Guide
-
Clone this repository
git clone https://github.com/the-repo-url.git
-
Navigate into project directory:
cd repo-name
-
Rename
.docker.env
and.example.env
provided to.env
and input your your set values -
Run LocalStack using docker-compose. A docker-compose.yml file is provided in the repository.
-
Run
docker-compose up --build
to connect to the database using docker and build the localstack to mock the AWS SES Service. -
Make sure to run your installed docker to run the docker engine in the background.
-
Run the
https://localhost:3000/email/test
to test that the SES(via LocalStack) is running
- Run
npm install
to install all required dependencies. - Make sure PostgreSQL is running.
- Update the
.env
file with your PostgreSQL credentials. - Run
npm run start:dev
to start the local development server.
- Run
npm install
to install all required dependencies. - Run
ng serve
for a dev server. Navigate tohttp://localhost:4200/
.
field | data_type | constraints |
---|---|---|
string | required, unique | |
username | string | required, unique |
password | string | required |
- Route: auth/signup
- Method: POST
- Body:
{
"username": "John Does",
"email": "john@gmail.com",
"password": "password23",
}
- Responses
Success
{
"user": "bliss",
"message": "Signup Successful"
}
- Response statusCodes
- 201: success || Created
- 409: error || Conflict Error
- 400: error || Bad Request
- 500: error || Internal Server Error
- Route: auth/login
- Method: POST
- Body:
{
"email": "janetdoe@gmail.com",
"password": "password"
}
- Responses
Success
{ "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI0ZmIyZmYwOS1mYTlkLTQ2MjEtOTFlMS0wZDZlYzVkMDg5Y2YiLCJmdWxsTmFtZSI6IkphbmV0IERvZSIsImVtYWlsIjoiamFuZXRkb2VAZ21haWwuY29tIiwiaWF0IjoxNjgyNDExNTA5LCJleHAiOjE2ODI0MTMzMDl9.N36xJBna2geYixgjj7HRJelCiaqco9akdjn0sYsBOtE"
}
field | data_type | constraints |
---|---|---|
to | string | required, |
from | string | required, |
subject | string | required, |
body | string | required |
userId | string | optional |
createdAt | Date | |
updatedAt | Date |
- Route:
/emails/create
- Method: POST
- Header -authorization : Bearer {token}
- Body:
{
"to": "recipient@example.com",
"from": "sender@example.com",
"subject": "Hello",
"body": "This is a test email"
}
- Responses
Success
{
"subject": "Hello",
"body": "This is a test email",
"user": {
"id": `${userId}`,
"username": "John",
"email": "john@gmail.com"
},
"id": `${emailId}`,
"createdAt": "2023-05-23 20:32:00.125668+01"
}
- Route:
/emails
- Method: GET
- Header -authorization : Bearer {token}
- Responses
Success
{
[`{Lists of emails}`]
}
- Route:
/emails/:id
- Method: GET
- Header -authorization : Bearer {token}
- Responses
Success
{
[`{email id}`]
}
- Route:
/emails/:id/reply
- Method: POST
- Header -authorization : Bearer {token}
- Body:
{
"reply": "This is a test reply"
}
- Responses
Success
{
"message": "Reply sent"
}
- The Home page displays a list of emails.
- Click on an email to view its details and replies.
- Click on 'Create Email' to compose a new email.
- You can reply to an email from its details page.
This project is licensed under the MIT License.