Add beginnings of an api

This commit is contained in:
James Wang 2015-12-22 20:37:38 -05:00
parent b6800b5b47
commit 869ce7a269
3 changed files with 32 additions and 17 deletions

0
server/api/__init__.py Normal file
View file

11
server/api/api.py Normal file
View file

@ -0,0 +1,11 @@
from flask import Blueprint
api = Blueprint("api", __name__)
@api.route("/api/register", methods=["POST"])
def register():
pass
@api.route("/api/login", methods=["POST"])
def login():
pass

View file

@ -1,75 +1,79 @@
from flask import Flask
import sys import sys
import config import config
from api.api import api
from flask import Flask
app = Flask(__name__) app = Flask(__name__)
app.secret_key = config.SECRET app.secret_key = config.SECRET
#Home Page #Home Page
@app.route("/") @app.route("/")
def hello_world(): def hello_world():
return "Hello, EasyCTF!" return "Hello, EasyCTF!"
#Login Page #Login Page
@app.route('/login') @app.route('/login')
def login(): def login():
return "EasyCTF Login" return "EasyCTF Login"
#Registration Page #Registration Page
@app.route('/register') @app.route('/register')
def register(): def register():
return "EasyCTF Register" return "EasyCTF Register"
#Scoreboard Page #Scoreboard Page
@app.route('/scoreboard') @app.route('/scoreboard')
def scoreboard(): def scoreboard():
return "EasyCTF Scoreboard" return "EasyCTF Scoreboard"
#Problems Page #Problems Page
@app.route('/problems') @app.route('/problems')
def problems(): def problems():
return "EasyCTF Problems" return "EasyCTF Problems"
#Account Page #Account Page
@app.route('/account') @app.route('/account')
def account(): def account():
return "EasyCTF Account" return "EasyCTF Account"
#Programming Page #Programming Page
@app.route('/programming') @app.route('/programming')
def programming(): def programming():
return "EasyCTF Programming" return "EasyCTF Programming"
#Chat Page #Chat Page
@app.route('/chat') @app.route('/chat')
def chat(): def chat():
return "EasyCTF Chat" return "EasyCTF Chat"
#About Page #About Page
@app.route('/about') @app.route('/about')
def about(): def about():
return "EasyCTF About" return "EasyCTF About"
#Forgot Password Page #Forgot Password Page
@app.route('/forgot_password') @app.route('/forgot_password')
def forgot_password(): def forgot_password():
return "EasyCTF Forgot Password" return "EasyCTF Forgot Password"
#Logout Page #Logout Page
@app.route('/logout') @app.route('/logout')
def logout(): def logout():
return "EasyCTF Logout" return "EasyCTF Logout"
#Rules Page #Rules Page
@app.route('/rules') @app.route('/rules')
def rules(): def rules():
return "EasyCTF Rules" return "EasyCTF Rules"
#Team Page #Team Page
@app.route('/team') @app.route('/team')
def team(): def team():
return "EasyCTF Team" return "EasyCTF Team"
#Shell Page #Shell Page
@app.route('/shell') @app.route('/shell')
def shell(): def shell():
return "EasyCTF Shell" return "EasyCTF Shell"
#Updates Page #Updates Page
@app.route('/updates') @app.route('/updates')
def updates(): def updates():
return "EasyCTF Updates" return "EasyCTF Updates"
#Reset Password Page #Reset Password Page
@app.route('/reset_password') @app.route('/reset_password')
def reset_password(): def reset_password():
return "EasyCTF Reset" return "EasyCTF Reset"
if __name__ == "__main__": if __name__ == "__main__":
app.register_blueprint(api)
app.debug = "--debug" in sys.argv app.debug = "--debug" in sys.argv
app.run(port=8000) app.run(port=8000)