Skip to content

Instantly share code, notes, and snippets.

@cabreraalex
Created September 25, 2019 15:16
Show Gist options
  • Save cabreraalex/ada3e7a06fbf9f6a218f15b9e214850c to your computer and use it in GitHub Desktop.
Save cabreraalex/ada3e7a06fbf9f6a218f15b9e214850c to your computer and use it in GitHub Desktop.
from flask import Flask, send_from_directory
import random
app = Flask(__name__)
# Path for our main Svelte page
@app.route("/")
def base():
return send_from_directory('client/public', 'index.html')
# Path for all the static files (compiled JS/CSS, etc.)
@app.route("/<path:path>")
def home(path):
return send_from_directory('client/public', path)
@app.route("/rand")
def hello():
return str(random.randint(0, 100))
if __name__ == "__main__":
app.run(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment