GithubHelp home page GithubHelp logo

blankdots / pygradle-falcon-api Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 1.0 235 KB

Example of of building a Falcon REST API using PyGradle (using python-web-app plugin)

License: Apache License 2.0

Python 100.00%
gradle python falcon-api

pygradle-falcon-api's Introduction

PyGradle Falcon REST API

Example of of building a Falcon REST API using PyGradle (using python-web-app plugin). The functionality of the API is minimal has the following endpoints:

  • index - registers data sent via POST in a SQLite3 Database;
  • health - checks if the application is running.

To Do:

  • write tests
  • generate documentation from source code

Building and Running the application

Requirements

  1. Python 2.7
  2. Gradle 4.0+ https://gradle.org/
  3. Pypi Ivy repository either a local one (see https://github.com/linkedin/pygradle/blob/master/docs/pivy-importer.md for more information) or you can deploy your own version using https://github.com/blankdots/ivy-pypi-repo

Building the application

After all the requirements are satisfied in the root directory run gradle build

Running the application

To use the deployable artifact after build run ./build/deployable/bin/gunicorn webapp.webapi:webapp

To deploy the artifact on your a server unzip build/distributions/pygradle-falcon-api-1.0.tar.gz on one's server and run using ./gunicorn webapp.webapi:webapp (the options for gunicorn can be added to command such as port number ./build/deployable/bin/gunicorn webapp.webapi:webapp -b 127.0.0.1:4300 )

Example of requests:

curl -X POST \
  http://localhost:4300/0.1/index/ \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -d '{
  "author": "random author",
  "data": "Some random data."
}'
curl -X GET \
  http://localhost:4300/health \
  -H 'cache-control: no-cache'
curl -X GET \
  http://localhost:4300/0.1/index/1 \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json'

pygradle-falcon-api's People

Contributors

blankdots avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

pombredanne

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.