more html, a basic form for making links
change
commit c8630afd7298dcd916b75c9ebba10dc96af7cd0a
author Alpha Chen <alpha@kejadlen.dev>
date
parent ceb20f02
diff --git a/go_ji/__init__.py b/go_ji/__init__.py
index e50962d..704b6f0 100644
--- a/go_ji/__init__.py
+++ b/go_ji/__init__.py
@@ -1,5 +1,5 @@
 import sqlalchemy
-from flask import Flask, abort, g, render_template, request
+from flask import Flask, abort, g, redirect, render_template, request, url_for
 from sqlalchemy import select
 
 from go_ji.db import User, db_session
@@ -31,5 +31,10 @@ def shutdown_session(exception=None):
 
 
 @app.route("/")
-def hello_world():
-    return render_template('hello.html', name=g.user.login)
+def index():
+    return render_template("hello.html", name=g.user.login)
+
+
+@app.route("/links", methods=["POST"])
+def create_link():
+    return redirect(url_for("index"))
diff --git a/go_ji/templates/hello.html b/go_ji/templates/hello.html
index efc0b18..68bbff4 100644
--- a/go_ji/templates/hello.html
+++ b/go_ji/templates/hello.html
@@ -1 +1,18 @@
-<p>Hello, {{ name }}!</p>
+<!DOCTYPE html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8" />
+    <title>go-ji</title>
+    <meta name="viewport" content="width=device-width" />
+  </head>
+  <body>
+    <p>Hello, {{ name }}!</p>
+    <form action="{{ url_for("create_link") }}" method="POST">
+      <label for="short">short:</label>
+      <input type="text" id="short" name="short" />
+      <label for="long">long:</label>
+      <input type="text" id="long" name="long" />
+      <input type="submit" value="Create Link">
+    </form>
+  </body>
+</html>