Skip to content

Shaganashree97/translator

Repository files navigation

Translation App Backend - README

Installation & Setup

Follow the steps below to set up and run the translation app backend.

Prerequisites

  • Python 3.x installed
  • pip installed

Step 1: Clone the Repository

git clone https://github.com/Shaganashree97/translator.git
cd translator-backend

Step 2: Create a Virtual Environment (Optional but Recommended)

python -m venv venv
source venv/bin/activate  # On macOS/Linux
venv\Scripts\activate     # On Windows

Step 3: Install Dependencies

pip install -r requirements.txt

Step 4: Initialize the Database

python app.py

This will create users.db and necessary tables.

Step 5: Run the Flask Server

python app.py

The backend will start on http://0.0.0.0:5000.

API Endpoints

1. User Authentication

  • Register: POST /register (Send username & password)
  • Login: POST /login (Returns token)

2. Translation

  • Get Languages: GET /languages
  • Translate Text: POST /translate (Requires text & target_language)

3. User History

  • Get History: GET /history (Requires authentication)

Testing with cURL

curl -X POST http://localhost:5000/register -H "Content-Type: application/json" -d '{"username":"test","password":"1234"}'

Stop Server

Press CTRL+C to stop the running server.


Now your backend is ready to use! 🚀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published