Key Features • How To Use • Local Testing • API • The Stack • A Special Thank You • Lessons Learned • License
Website: https://morphapi.com
API: https://morph.now.sh
- Data manipulation using real language
- Quickly and easily navigate query parameters
- GUI to test how the API interprets human language
- Fully documented back-end with all available manipulation methods
The HTTP API may be a bit different than what you have used in the past.
The morph API base url is http://morph.now.sh/morph?input=. The difference, is that you can use a natural sentence in the request url.
Here are some examples of how to use the HTTP API:
Uppercase the word 'morph'
Request:
http://morph.now.sh/morph?input=uppercase morph
Response:
{
"function": "The almighty Morph",
"output": "['MORPH']"
}
Capitalize the sentence 'this is how we do it'
Request:
http://morph.now.sh/morph?input=capitalize the sentence 'this is how we do it'
Response:
{
"function": "The almighty Morph",
"output": "['This is how we do it']"
}
Perform multiple operations on something
Request:
http://morph.now.sh/morph?input=capitalize, uppercase, and byte_size the sentence 'this is a sentence'
Response:
{
"function": "The almighty Morph",
"output": "['This is a sentence', 'THIS IS A SENTENCE', 18]"
}
Commands to try
uppercase gargantuan
capitalize diabolical
lowercase SCREAMING
what is the byte size of bubbles
capitalize every word in 'how does this work'
uppercase the sentence 'this is how we do it'
capitalize, uppercase, and give me the byte size of randomness
ALPHA what is the factorial of 5?
To clone and run this application, you'll need Git, Python and Node.js (which comes with npm) installed on your computer. From your command line:
The application can be run in two different ways:
- Back-end API only
- Full application
Back-end API only
# Clone this repository
$ git clone https://github.com/johnatspreadstreet/morph.git
# Go into the repository
$ cd morph
# Install dependencies
$ pip install -r requirements.txt
# Run the backend api
$ python3 index.py
Full application
# Clone this repository
$ git clone https://github.com/johnatspreadstreet/morph.git
# Go into the repository
$ cd morph
# Install dependencies, or use venv
$ pip install -r requirements.txt
$ cd client/
$ npm install
# Run the backend api locally
$ python3 index.py
# Run the front end React app
$ cd client/
$ npm start
Note: If you're using Linux Bash for Windows, see this guide or use node
from the command prompt.
API Documentation can be found at the following link: https://morph.now.sh
- React
- Axios
- Tailwindcss
- Now 2.0
- Python
- Flask
- Flask Rest Plus
- Wit.ai
This project was my first foray into switching programming languages. It is amazing how quickly you can forget how comfortable you are in your own domain (for me, JavaScript).
Here are some lessons learned:
- CORS (Cross Origin Resource Sharing) is a giant headache in ANY language
- Now 2.0 (formerly Zeit) is an incredibly cool concept, but should not be used for a Python backend just yet (~March 2019)
- Wit.ai makes NLP significantly easier to understand and implement
I find the 'gotcha!' aspects of programming languages to be the most difficult to learn when switching. For example, people switching to JavaScript from another language may find the bracket syntax to be awkward. Python had a few 'gotcha!'s for me:
- The import syntax was not easy for me to pick up. It took me a significant amount of time to learn the differences between modules, packages, where to include init files, etc.
- Anything with deployment (for any language) can be a headache
- Trying to reason between Python 2x and Python 3x
- I still do not understand how a venv works, or even the point of it
- I was never able to get a linter working, and still not sure why (maybe existing ESLint is screwing it up?)
A very big thank you goes out to the following individuals who helped me create Morph. It would not have been possible without you:
- Chris Angelico, aka 'Rosuav'
- All my partners in crime in Thinkful EI-27
Creative Commons Attribution 4.0
Built by: John Young, Full-Stack Engineer