It is sunday again, so time for a new update. I did it… i quit… Node.js (for now). Yes I was quite frustrated and had a look at flask since it seemed to be easier to learn. And yes, for me it was easier to grasp and in only 2 days I archieved more than with Node.js and Express. But to be honest, it was not so different from Express. You build your templates, use different endpoints and make your Requests.
What I really like is that Flask allows to me integrate the operations in use in my job (even though i´m faily new to python) and integrate them in Web dev. Like this: Pandas for calculation, managing data and more and passing this data to the template.
@app.route("/allusers", methods=["POST", "GET"])
def allusers():
if request.method == "GET":
user_collection = mongo.db.users
df = pd.DataFrame(list(user_collection.find()))
df["price"] = df["price"].apply(pd.to_numeric)
result = round(df["price"].mean(), 2)
return render_template(
"/result.html",
result=result,
nrow=df.shape[0],
series=list(df["price"]),
description=list(df["description"]),
)
Maybe I will come back to node.js later, but so far I am very happy with using python on the backend. Next week I will try to build on upon what I did so far and then hopefully will be finally be able to deploy an app on my own server :-).
This archievement gave me a boost of motivation, which hopefully holds on, because there will be so much failure and there is a ton of new stuff to learn… Linux Servers, more shell commands and in one month my 2 fulltime react weeks will start