def handle_tweets():
    '''Returns all tweets as JSON objects in an array with a GET
    request.
    '''
    if request.method == 'GET':
        arr = []
        for tweet in Tweet.select():
            arr.append(tweet.to_hash())
        return jsonify(arr), 200

    elif request.method == 'POST':
        params = request.values
        tweet = Tweet()

        for key in params:
            setattr(tweet, key, params.get(key))
        tweet.save()
        return jsonify(tweet.to_hash()), 200