Skip to content

Commit

Permalink
Merge pull request #50 from DanielAraldi/feat/update-readme
Browse files Browse the repository at this point in the history
docs: create readme and requirements to the project
  • Loading branch information
DanielAraldi authored Jan 11, 2024
2 parents 3f35ac4 + 418eb51 commit 5f6c68b
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Username and password of the https://mailtrap.io/
# Your Gmail username and password
MAIL_LOGIN=
MAIL_PASSWORD=

Expand Down
2 changes: 1 addition & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
{ "type": "feat", "release": "minor" },
{ "type": "chore", "release": "minor" },
{ "type": "build", "release": "patch" },
{ "type": "docs", "release": "patch" },
{ "type": "fix", "release": "patch" },
{ "type": "perf", "release": "patch" },
{ "type": "style", "release": "patch" },
{ "type": "ci", "release": false },
{ "type": "docs", "release": false },
{ "type": "refactor", "release": false },
{ "type": "temp", "release": false },
{ "type": "test", "release": false }
Expand Down
62 changes: 48 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,63 @@
# Mailer 📫

<div style="width: 100%; display: flex; gap: 10px">
<div style="width: 100%; display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: center; align-items: center; gap: 8px">

[![wakatime](https://wakatime.com/badge/user/920a7e43-2969-4212-82ff-1b375685ff58/project/00e95626-aa7e-4501-a6fd-3f315bc40b35.svg)](https://wakatime.com/badge/user/920a7e43-2969-4212-82ff-1b375685ff58/project/00e95626-aa7e-4501-a6fd-3f315bc40b35)

[![Coverage Status](https://coveralls.io/repos/github/DanielAraldi/mailer/badge.svg?branch=feat/send-mail-controller)](https://coveralls.io/github/DanielAraldi/mailer?branch=feat/send-mail-controller)

<a href="https://www.npmjs.com/package/git-commit-msg-linter">
<img src="https://badgen.net/badge/git-commit-msg-linter/3.0.0/yellow" alt="commit msg linted by git-commit-msg-linter" />
</a>

</div>

> Mailer is a micro-saas used to send emails 📩
<p align="center">
<img alt="GitHub top language" src="https://img.shields.io/github/languages/top/DanielAraldi/Mailer?style=flat-square">
<img alt="GitHub language count" src="https://img.shields.io/github/languages/count/DanielAraldi/Mailer?style=flat-square">
<img alt="GitHub" src="https://img.shields.io/github/license/DanielAraldi/Mailer?style=flat-square">
</p>

<p align="center">
<a href="#📖-about">About</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
<a href="#📫-api">API</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
<a href="#🛠️-how-to-execute">How to Execute?</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
<a href="#🏷️-license">License</a>
</p>

## 📖 About

The Mailer is a service used only to send e-mail messages to people, it's focused to the business. We recommend that you use your app passwords that it's available from Google. You can create an app password [clicked here](https://myaccount.google.com/apppasswords).

## 📫 API

There are Mailer's endpoint. All endpoint starts with slug `/api`.

[`/send`](./requirements/send.md) - Endpoint to send e-mail message.

## 🛠️ How to Execute?

- ### **Prerequisite**

- It's **necessary** to possess the **[Git](https://git-scm.com/)** and **[Docker](https://www.docker.com/products/docker-desktop/)** installed and configured in your computer.
- Also, it's **need** to have a package manager as **[Yarn](https://yarnpkg.com/)**, **[NPM](https://www.npmjs.com/)**, etc.
- Finally, it's **necessary** to have **[Node.js](https://nodejs.org/en)** greater or equal version 16.13.x.

1. Make a clone of repository:

```sh
$ git clone https://github.com/DanielAraldi/mailer.git
```

## Introductions 📖
2. Added environment variables:

- [Commands 🖖](#commands-🖖)
Create a new file on root path called `.env`. Using the `.env.example` file as model and added the variables that exist it for your `.env` file.

## Commands 🖖
3. Executing the application:

- Create the project's `dist` folder: `npm run build`
- Monitors and updates the `dist` folder: `npm run build:watch`
- Run the project: `npm run start`
```sh
$ npm i # or yarn install to install all dependencies.
$ npm run build # or yarn build to create dist folder with `.js` files that will be used in production.
$ npm run up # or yarn up to run database in the docker. To stop the database run the `npm run stop` command.
$ npm run start # or yarn start to run application.
```

## License
## 🏷️ License

We use the [MIT license](./LICENSE).
This e-mail service went development by [Daniel Sansão Araldi](https://github.com/DanielAraldi) and [Rafael Mota Alves](https://github.com/RafaelMotaAlvess). We use the [MIT license](./LICENSE).
33 changes: 33 additions & 0 deletions requirements/send.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Send e-mail

Send e-mail endpoint is found on the `/api/send` path via `POST` HTTP method.

## Parameters

This endpoint is used to send e-mail, it accepts the following parameters:

| field | type | description | required |
| ---------- | ---------- | -------------------------------------------------------------------------------------- | -------- |
| `from` | `string` | The e-mail address of the sender. ||
| `to` | `string[]` | An `array` of recipients e-mail addresses that will appear on the **To** field. ||
| `title` | `string` | The title of the e-mail. ||
| `message` | `string` | E-mail message. ||
| `login` | `string` | Your e-mail login to you be authentication in the Google e-mail service. ||
| `password` | `string` | Your app password available by Google to be authenticate in the Google e-mail service. ||
| `username` | `string` | Your username or alias. ||

> To know more about the apps password, [click here](https://myaccount.google.com/apppasswords).
The API will go to return **no content** when your e-mail went to sended with success.

## Errors

1. If some of the required properties doesn't sent for API request, an error HTTP 400 will be returned.
2. An internal server error occurs in API during request, the API will return HTTP 500 error.
3. If email doesn't sended with success, the API will return HTTP 400 error with an message that occurred a failed.

The API error object will contain the follow properties:

| field | type | description | required |
| ------- | -------- | ------------------------------------ | -------- |
| `error` | `string` | The error message returned from API. ||

0 comments on commit 5f6c68b

Please sign in to comment.