backend: initi backend
This commit is contained in:
24
backend/src/server.py
Normal file
24
backend/src/server.py
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
'''
|
||||
server.py is the main source file for the Dungeon's backend service.
|
||||
'''
|
||||
|
||||
from flask import Flask, request, jsonify
|
||||
from dotenv import load_dotenv
|
||||
from db_client import DBClient
|
||||
|
||||
load_dotenv()
|
||||
app = Flask(__name__)
|
||||
database = DBClient()
|
||||
|
||||
@app.route('/login', methods=['POST'])
|
||||
def login():
|
||||
if request.is_json:
|
||||
return request.json, 200
|
||||
else:
|
||||
return jsonify({'error': 'Request must contain JSON data'}), 400
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
Reference in New Issue
Block a user