Skip to content

Commit

Permalink
Merge pull request #2 from duzz-system/dev/api/#1-criar-estrutura-da-api
Browse files Browse the repository at this point in the history
Featured: #1. Inicializada estrutura da API
  • Loading branch information
Jonasdart authored Jul 7, 2021
2 parents d10f39e + 079e15f commit 5f97a5f
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions commons/db/create.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
create database `duzz-pedidos`;
Empty file added commons/db/create_tables.sql
Empty file.
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
flask
flask_restful
flask_cors
1 change: 1 addition & 0 deletions resources/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from resources.pedidos import Pedidos
19 changes: 19 additions & 0 deletions resources/pedidos/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from flask_restful import Resource

class Pedidos(Resource):
def get(self):
return {
'codigo': 1
}


def put(self):
pass


def post(self):
pass


def delete(self):
pass
24 changes: 24 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from logging import debug
from flask import Flask
from flask_restful import Api
from flask_cors import CORS

from resources import (
Pedidos
)

app = Flask(__name__)
CORS(app)
api = Api(app)


@app.route('/')
def index():
return """
<h1> Hello World!
"""

api.add_resource(Pedidos, '/pedidos')

if __name__ == '__main__':
app.run(debug=True)

0 comments on commit 5f97a5f

Please sign in to comment.