funkyserver

FunkyServer is simple package to create Flask servers in background processes.


License
MIT
Install
pip install funkyserver==0.1

Documentation

funkyserver

FunkyServer is a simple package to create Flask servers in background processes.

##Installation Install funkyserver easily with pip

pip install funkyserver

##Instructions

Initialization

To get started, import the funkyserver package and create a FunkyServer object. The FunkyServer object will be where all of the magic happens.

from funkyserver import FunkyServer
funky = FunkyServer()

Setting Defaults

You can use getter and setter methods to change the host and the port for each FunkyServer object. It's useful if you're intending to run multiple servers at once.

funky.get_host() #returns 'localhost'
funky.set_port(1337)

Adding Endpoints

What use is a web server if it goes nowhere? Add endpoints to your server the same way you would use Flask's add_url_rule method.

def hello_world():
    return "Hello funky world!"

funky.add_endpoint(endpoint='/', endpoint_name='hello_world', handler=hello_world)  

Starting and Stopping the Server

Use the start() method to load up a Flask server in a new background process. Use the stop() method to stop the process and the server whenever you're ready. It's that simple!

x.start() #Start server and open a new window at host:port
x.start(open_new_window=False) # Start server, but do not open a new window
x.stop() #Stop the background process, and thus the server