Skip to content

alvarobartt/restx-cookie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask-RESTX API as a Python Package Cookie
cookie-monster

Features

This cookie provides the following features:

  • A Flask-RESTX API properly defined skeleton
  • An argparse client which defines the entry point of the API
  • Pytest unit tests
  • Swagger.io automatic API reference documentation
  • and much more that will be progressively included...

Installation

Firstly, you will need to install cookiecutter using pip from a Python3.6 version or higher since this cookie recipe just works on Python3.6+; use the following command:

pip install cookiecutter

So as to create your own cookie from this recipe you will need to clone this repository using the following command:

git clone https://github.com/alvarobartt/restx-cookie

Once it is properly cloned, from the working directory, you will need to pass the cloned cookie as an argument to the cookiecutter entry point as it follows:

cookiecutter /path/to/restx-cookie

This command will launch the cookiecutter prompt into your terminal, which will ask you some configuration options as specified in the cookie recipe for you to select the most suitable ones according to your needs.

So to bake this cookie, the cookiecutter prompt will ask you to select the following ingredients (configuration) in case you want to name your cookie (project), for example, lets suppose that your project will be named awesome_cookie its configuration will be:

author [Alvaro Bartolome del Canto]: Cookie Monster
email [alvarobartt@example.com]: cookiemonster@sesamestreet.com
github_username [alvarobartt]: cookie-monster       
project_name [Flask Restx API]: awesome-cookie
project_description [This project is a sample Python Flask Restx API]: This is an awesome cookie!   
repo_name [awesome_cookie]: awesome_cookie
package_name [awesome_cookie]: awesome_cookie
pypi_username [cookie-monster]: cookie-monster
version [1]: 1
flask_limiter [yes]: yes
flask_cache [yes]: yes
flask_cors [yes]: yes
Select license:
1 - MIT License
2 - BSD License
3 - ISC License
4 - Apache Software License 2.0
5 - GNU General Public License v3
6 - WTFPL License
7 - None
Choose from 1, 2, 3, 4, 5, 6, 7 [1]: 1

When this process is finished, automatically a directory named as specified in repo_name will be created containing the following files and directories:

awesome_cookie/ MANIFEST.in README.md requirements.txt setup.cfg setup.py tests/

Congratulations! You already baked your own restx-cookie!

Usage

Once the cookie is completely baked, you can take it off the oven! So on, from the repo_name previously created directory, so as to install the Flask RESTX API (since it is a Python package) you will need to run on of the following commands: pip install . or python setup.py install, which will install not just the package but all its dependencies.

Once the newly created cookie is installed, just paste its entry point on the command line as it follows:

awesome_cookie

The entry-point will launch the Flask RESTX API in your public IP (0.0.0.0) in the port 5000 using the current version (which by deafult is the v1 version), so the complete address of the API is: http://0.0.0.0:5000/v1. In that address you will find the Swagger.io documentation automatically generated so as to know which endpoints are available, which data models are integrated, which is the input/output structure, etc.

Now you are completely free to eat your cookie!

Cookie recipe created by...


Álvaro Bartolomé

💻 📖🤔

Gabriel Martín

💻🤔

Want more cookies?

You can find a curated collection of self made cookies at cookie-jar

You don't like this cookie? You don't like the chef/chefs?

If you don't like neither the cookie neither the chef (or chefs), to each his own... here we do not judge you (just a little), here you have a list of some similar cookie recipes you may like:

You want to become a chef too?

Maybe after seeing this cookie recipe your inner chef spirit came out and you decided to become a chef, well, we already thought this may happen, so here you have a list of useful links on your way to become a real chef (well, not a real one just a programming chef somehow):

Releases

No releases published

Packages

No packages published

Languages