Update CORS list
Fix Python version formatting
Bump Python version
translator is a tool that shows the translation of a word in many other languages.
This application was originally written in 2012 to gain some familiarity with Node.js. It seemed like a suitable application to resurrect in order to explore some different client and server technologies that I haven't had a chance to work with.
In this repository there are three client and three server implementations.
Client
Server
As I only have prior experience with Python, the other implementations may very well range from rough around the edges to a pile spaghetti.
Aside from the languages and their tooling, the only other requirement is to have an API key for using Microsoft's Translator Text API. Once you have this key, set it as the value of the environment variable AZURE_TRANSLATOR_KEY
. Each server implementation will read this environment variable.
The following instructions describe how to run this application locally using each implementation.
Before we get implementation specific, we'll need the source code, so go ahead and clone this repository.
Then jump to any section below for instructions on how to run a particular implementation.
Note Each client tries to connect to the server on port 8181 and each server listens on port 8181. The Python and Racket server implementations can have their port set by command line and an environment variable, respectively, but the Clojure server implementation and client implementations are hardcoded. Tidying this up will be an additional exercise to learn about configuration best practices.
The Python server implementation is written in Python 3 and makes use of the FastAPI web framework. It is assumed you have Python 3 installed.
First of all, change to the server-python
directory.
$ cd server-python
Then create a virtual environment with venv and activate it.
$ python3 -m venv env
$ . env/bin/activate
Now we can install the third-party packages.
(env) $ pip install -r requirements.txt
Finally, the last step is to run the server.
(env) $ uvicorn app:app --reload --port 8181
If you don't have Racket installed it's very simple. Head on over to racket-lang.org and follow the download and installation instructions.
Once installed, change to the server-racket
directory.
$ cd server-racket
Then just run the program.
$ racket server.rkt
In order to run the Clojure server implementation you will need Clojure and Leiningen.
The Getting Started page on the Clojure website has very simple instructions outlining how to install Clojure.
Similarly, the Install section of the Leiningen website has very simple installation instructions.
Once you have both Clojure and Leiningen installed on your system, change to the clojure
directory.
$ cd clojure
Then start the application. Leiningen will fetch all required dependencies which may take a little time.
$ lein run
Change to the client-vue
directory.
$ cd client-vue
Install the dependencies with yarn.
$ yarn install
Finally, run the application.
$ yarn serve
The application will be served at http://localhost:8080/.
Change to the client-react
directory.
$ cd client-react
Install the dependencies with yarn.
$ yarn install
Finally, run the application.
$ yarn start
The application will be served at http://localhost:3000/.
Change to the clojure
directory.
$ cd clojure
Start the application.
$ lein fig:build
The application will be served at http://localhost:9500/.