Giter Club home page Giter Club logo

Comments (3)

incognos avatar incognos commented on July 26, 2024

Stop torturing him @ParentJA :-) - question, why use this framework instead of Serverless https://www.serverless.com ? Up https://up.docs.apex.sh ? Architect https://arc.codes/guides/offline? You might want to add yourself to https://github.com/anaibol/awesome-serverless

from minik.

pdiazvargas avatar pdiazvargas commented on July 26, 2024

@incognos great resources indeed! however, using a nodejs library to write python serverless API is not ideal at all. Also, if you're interested in python frameworks, I would actually suggest https://github.com/aws/chalice

The main purpose of this project was to create a minimal serverless framework. This means it will not have full feature parity with django or flask, but it will be functional and lightweight.
Give it a try!

from minik.

pdiazvargas avatar pdiazvargas commented on July 26, 2024

Using metadata annotations seems to be a really natural fit for this type of feature. After a few iterations, this is how the route definition looks like:

@sample_app.route('/articles/{year}/{month}/', methods=['GET'])
def get_articles_view(year: int, month: int):
    # match /articles/2015/10/
    # match /articles/2020/5234 which is not ideal.
    # does not match /articles/2020/ten
    assert isinstance(year, int) and isinstance(month, int)
    return {'year': year, 'month': month}

Note that in order to implement the uuid, I was able to use the standard uuid.UUID class. The added advantage is that the product_id field that gets passed to the view is already an instance of the object.

@sample_app.route('/product/{product_id}/', methods=['GET'])
def get_product(product_id: uuid.UUID):
    assert isinstance(product_id, uuid.UUID)
    return {'id': str(product_id)}

Thoughts?

from minik.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.