/impossibilicus-api

Back-end for an interactive editor for interactive fiction

Primary LanguageRich Text Format

proj-api

This is the simplest possible API to interact with the UI (that will soon be commited) in proj

Documentation of Libraries Used

  • Flask - minimal python web framework
  • Flask-RESTful - library that adds helpful REST conventions to Flask

Requirements

Starting the API

  • Start Mongo with mongod (if you're running Mongo locally, otherwise it just needs environment varibles set to reference the hosted DB)
  • From the project directory, create/activate a virtual environment (step-by-step instructions also in Flask's virtualenv docs)
  • Install the project dependencies with pip install -r requirements.txt
  • Environment variables that need to be set for the app to work: MONGODB_URI, MONGO_USERNAME (these live permanently in Heroku, I'm not committing them because even though this is private now, something something commit history)
    • Optionally, FLASK_DEBUG=1 to enable flask's debug mode, which will live update the app when changes are made and display more detailed error outputs
  • Start the API with python app.py
  • Confirm that it is running by accessing http://localhost:5000/
  • Use any REST client to make API calls (I use Insomnia)

Deploying

  • Application is automatically deployed on Heroku when a new commit is pushed to master

MongoDB Commands

  • Connect (requires Mongo installed): mongo ds147510.mlab.com:47510/database_name -u username -p password
  • Empty out a collection ("story"): db.story.remove({})