Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rosekamallove/newsletter-api

This is a API allowing the user to send emails to the subscribed users in the database, the subscribers can be subscribed to a various topics or all the topics. The user of the API can schedule the sending of the email to the priciseness of a second.
https://github.com/rosekamallove/newsletter-api

Last synced: 12 days ago
JSON representation

This is a API allowing the user to send emails to the subscribed users in the database, the subscribers can be subscribed to a various topics or all the topics. The user of the API can schedule the sending of the email to the priciseness of a second.

Awesome Lists containing this project

README

        

## Tech Used:

`express`, `nodemailer`, `node-schedule`, `mongodb`

## Steps to Configure:

### Step 1:

**Configure the `.env` file**

```
$: cat .env.example

mongooseUri=
contactEmail=
contactPassword=
contactHost=
```

- Create a `.env` files and add the above variables to it with their corresponding values.
- To get the mongoose uri you can follow [this](https://mongoosejs.com/docs/connections.html) guide
- Then to get SMTP mail, password and HOST you can follow [this](https://nodemailer.com/usage/why-smtp/) guide

### Step 2

- Configure the time at which emails has to be sent
- This can be done by editing the following line, by following [this](https://www.npmjs.com/package/node-schedule) guide
- Line **71** in `/scheduler/mailer.js`

```js
schedule.scheduleJob("*/10 * * * * *", async function ()
```

### Step 3

- Run the application by running these commands:

```
$: nodemon app.js
$: nodemon ./daemons/subscription.daemon.js
```