-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
20 lines (15 loc) · 682 Bytes
/
app.py
File metadata and controls
20 lines (15 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from flask import Flask
from flask_restful import Api
from flask_jwt import JWT
from security import authenticate, identity
from user import UserRegister
from item import Item, ItemList
app = Flask(__name__)
app.secret_key = 'ashu'
api = Api(app)
jwt = JWT(app, authenticate, identity) # creates a /auth endpoint which inturn after calling creates a jwt token
api.add_resource(Item, '/item/<string:name>')
api.add_resource(ItemList, '/items')
api.add_resource(UserRegister, '/register')
if __name__ == '__main__': # if the name is equal to the run file... done to ensure that we need to to the below steps after executing the app only
app.run(port=5000, debug=True)