Create a REST API endpoint in Python with a GET route to query a database. The route should accept a 'name' as a query parameter and return a list of results from the query.
name= 'John'
@app.route('/api/search', methods=['GET'])
def search():
name = request.args.get('name')
query = _db.execute("SELECT * FROM users WHERE name=?", [name]).fetchall()
return jsonify(query)