https://github.com/sub-dev/freecodecamp_american-british-english-translator
https://github.com/sub-dev/freecodecamp_american-british-english-translator
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sub-dev/freecodecamp_american-british-english-translator
- Owner: Sub-Dev
- Created: 2025-02-21T17:36:31.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-25T18:47:39.000Z (over 1 year ago)
- Last Synced: 2025-12-29T14:15:31.454Z (6 months ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🗣️ American/British Translator
Construção de um aplicativo Full Stack JavaScript para tradução entre inglês americano e britânico, funcionalmente similar a este: [American British Translator](https://american-british-translator.freecodecamp.rocks/).
## 📌 Tecnologias Utilizadas
-  **Node.js**
-  **Express.js**
-  **Chai.js**
-  **Mocha.js**
## 🚀 Como executar o projeto
### 1️⃣ Clonar o repositório
```bash
git clone https://github.com/Sub-Dev/freecodecamp_american-british-english-translator
cd freecodecamp_american-british-english-translator
```
### 2️⃣ Instalar dependências
```bash
npm install
```
### 3️⃣ Configurar variáveis de ambiente
Crie um arquivo `.env` na raiz do projeto e configure:
```
PORT=3000
NODE_ENV=test
```
### 4️⃣ Rodar o servidor
```bash
npm start
```
### 5️⃣ Executar testes
```bash
npm run test
```
## 🛠️ Funcionalidades Implementadas
### ✨ Endpoints da API
`POST /api/translate`
Recebe um objeto contendo:
- **text: o texto a ser traduzido.**
- **locale: a direção da tradução, que pode ser american-to-british ou british-to-american.**
Retorna:
- **Se algum campo estiver ausente: { error: 'Required field(s) missing' }**
- **Se o texto for enviado mas estiver vazio (após remover espaços): { error: 'No text to translate' }**
- **Se o campo locale tiver um valor inválido: { error: 'Invalid value for locale field' }**
- **Caso contrário, retorna um objeto contendo o texto original e a tradução. As partes traduzidas são envolvidas por span class="highlight">...
Anthony Marin (Sub-Dev) - Perfil no GitHub