Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplest Example Possible #4

Open
mpetyx opened this issue Oct 2, 2015 · 5 comments
Open

Simplest Example Possible #4

mpetyx opened this issue Oct 2, 2015 · 5 comments
Assignees

Comments

@mpetyx
Copy link

mpetyx commented Oct 2, 2015

Hey!
I really like raml, and I love flask!
I just stumbled upon this project and I would like to start using it.
The way I understood it, having a raml file I can have a simple server like osprey does but for python.. Right?
If you could provide a super small example of usage or some basic walkthrough I would like to use or contribute to this library.
Cheers,
Michael.

@freddrake
Copy link

+1

I'm starting to work with RAML for an application using Flask-RESTful, and am looking at integration options.

@iki iki self-assigned this Oct 14, 2015
@wasade
Copy link

wasade commented Nov 4, 2015

I agree, a very simple practical example would be invaluable.

@astewart-twist
Copy link

+1

@iki
Copy link
Contributor

iki commented Nov 18, 2015

Will try to do find time for a basic sample around the end of year.

For now, what about very basic:

from flask.ext.raml import API

api = API(app, path='static/docs/api/api.yaml')
   # generate an all-inclusive yaml with gulp apiyaml task https://gist.github.com/iki/784ddd5ab33c1e1b726b 

@api.route('/my/route/path/1', 'post')
def handler(id):
  if not data:
    api.abort(404, 'id does not exist');
  return dict(received=True)

from handlers import handler2
api.add_route('/my/route/path/2', handler2)

More info on route params in source for now.

cc @mpetyx @freddrake @wasade @astewart-twist

@s0undt3ch
Copy link

This does not do any kind of payload validation, does it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants