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

https://github.com/robson-carvalho/thenews-tech-backend

A REST API that sends daily emails to subscribers with the latest technology news.
https://github.com/robson-carvalho/thenews-tech-backend

Last synced: 3 months ago
JSON representation

A REST API that sends daily emails to subscribers with the latest technology news.

Awesome Lists containing this project

README

        

The News Tech API 💻


Technologies
Getting Started
API Endpoints
Collaborators
Contribute


A REST API that sends daily emails to subscribers with the latest technology news.


GitHub Stars
GitHub Forks
GitHub Issues
Build Status
License

💻 Technologies

- Node.js
- Express
- Node-Cron
- PostgreSQL
- Nodemailer
- TypeScript

🚀 Getting started

Here you describe how to run your project locally

Prerequisites

- [Node.js](https://nodejs.org/)
- [Git](https://git-scm.com/)
- [PostgreSQL](https://www.postgresql.org/)

Cloning

```bash
git clone https://github.com/Robson-Carvalho/thenews-tech-backend.git
```

Config .env variables

Use the `.env.example` as reference to create your configuration file `.env` with the required variables:

```yml
PORT=
DATABASE_URL=

EXTERNAL_NEWS_API=
UNSUBSCRIBER_LINK=

NODEMAILER_EMAIL_USER=
NODEMAILER_PASSWORD=
```

Starting

```bash
cd thenews-tech-backend
npm install
npm start
```

📍 API Endpoints

| Route | Method | Description |
| ------------------------------- | ------ | ----------------------------------- |
| POST v1/subscriber | POST | Subscribes a user to the newsletter |
| GET v1/subscriber | GET | Returns the number of subscribers |
| DELETE v1/subscriber | DELETE | Unsubscriber |

POST v1/subscriber

**REQUEST**

```json
{
"email": "[email protected]"
}
```

**RESPONSE**

```json
{
"status": "Success",
"message": "Registered"
}
```

GET v1/subscriber/count

**RESPONSE**

```json
{
{
"status": "Success",
"data": {
"count": 1
}
}
}
```

DELETE v1/subscriber

**REQUEST**

```json
{
"email": "[email protected]"
}
```

**RESPONSE**

```json
{
"status": "Success",
"message": "Deleted"
}
```

🤝 Collaborators




Robson Carvalho Profile Picture


Robson Carvalho



📫 Contribute

1. Fork this repository
2. Create a new branch: `git checkout -b feature/your-feature`
3. Commit your changes: `git commit -m 'Add some feature'`
4. Push to the branch: `git push origin feature/your-feature`
5. Open a Pull Request explaining your contribution

---

Made with ❤️ by [Robson Carvalho](https://www.linkedin.com/in/robson-carvalho-souza/).