This project is a simple implementation of the Google Translate API using Node.js and Express, deployed on Vercel. It allows users to translate text between multiple languages effortlessly.
- Free and unlimited access to the Google Translate API
- Automatic language detection
- Simple RESTful API for text translation
- Easy deployment and scalability using Vercel
-
Clone the repository:
git clone https://github.com/yourusername/translate-google-api-v1.git cd translate-google-api-v1
-
Install dependencies using Bun:
bun install
-
Start the application:
bun dev
Your API should now be running on http://localhost:3000/translate.
You can use tools like Postman, curl, or any HTTP client to make requests to the API.
To translate text, send a POST request to the /translate
endpoint with the following JSON body:
Request URL:
POST http://localhost:3000/translate
Example Request Body:
{ "text": "hello world", "from": "en", // Optional: Source language (use "auto" for automatic detection) "to": "es" // Target language }
You should receive a response similar to this:
"hola mundo"
POST /translate
If the from
field is omitted, the API will automatically detect the source language.
This application is deployed on Vercel. You can access the live API at:
https://translate-google-api-v1.vercel.app/translate
Feel free to fork this repository and submit pull requests. Any contributions are welcome!
- Thanks to Google for providing the Translate API.
- Thanks to Vercel for easy deployment options.