Submitted by twovests in just_post (edited )

Hi all,

I'm a programmer with no web dev experience. I know how networks work (IPs and ports and protocols and all that) and I have some security knowledge (so I'd know it's important to do string validation and all that).

I also know how to set up Linux servers, secure them, serve them over TLS with CertBot, and I've also run web apps such as Jupyter or Gitlab from those servers.

I have some simple projects I want to do, but not knowing web-dev is getting in the way of that. I know how to serve very basic HTML+CSS websites, but that's it.

So, I want to make a very simple four-function calculator. (Two text boxes, four buttons for four operations, sent to the server, which returns the result of the operation.) I know this can be done entirely in client-side JavaScript, but I want to learn to do this server side.

I understand there are a lot of Javascript frameworks, like React or Node.JS. I don't really know how to choose one or what to use though.


So, I'm wondering, if you (the experienced web dev) were to make this project, what tools/frameworks/etc. would you use? Should I use JavaScript on the server-side as well, or is it fine to use a language of my choice (i.e. Python)?

I'd imagine the stack to look like this:

[ Ubuntu/Linux server | Python backend, taking in and validating strings, and serving dynamic webpages | Static webpage served on something (Apache??) ]

If you have links or suggestions I'm open to them!! I won't be needing to connect this to a database or anything, so there's no SQL server attached here.

5

Comments

You must log in or register to comment.

twovests OP wrote

For reference, this is a Jan 2019 Ycombinator post describing a go-to stack: https://news.ycombinator.com/item?id=18829557

TLDR:

  • Frontend: React with TypeScript
  • Backend: Django (Python) or Rails (Ruby)
  • Databases: Postgres
  • Serve using: Nginx, with cookies for authentication
  • Tooling: Use VS Code for Javascript, and something called json-server in npm for a quick REST API

(I understand REST is sort of a language describing APIs that can be imported into various web frameworks?)

This sounds like what I have in mind, but I know a lot of people have strong opinions and I like to hear them.

2

musou wrote (edited )

if you're already comfortable with javascript, i would suggest express, but if you're totally new to the web dev game, i would suggest something like django or rails as they tend to be more "batteries included" and both python and ruby have less "gotchas" in terms of weird edge-case behavior than js does.

my all-time favorite web framework is actually phoenix, which is written in a newer language called elixir that runs on the erlang VM. this is a slightly more esoteric choice, but it's far from unproven technology (it is used at many companies you have probably heard of), and phoenix has a lot of nice features that i now miss any time i go back to the other choices i've listed here.

3

devtesla wrote

You probably don't need a front end but yea React is everywhere. Vue is a little saner than react.

I'd go with Django because Python is everywhere. I'm big into php but that's because I'm old.

Postgres is great.

I've never done the basic level server stuff, you can use a service like https://www.pythonanywhere.com/ that handles that. That all sounds right tho.

This poster uses VS Code, which everyone uses now and it's good but like I've said before, IDEs are really nice. Jetbrains....

And yea that's an easy way to make an API but if you're not having external applications interacting with your app you might not need one.

2

flabberghaster wrote

I find Ruby to be a fun language and I wish it had more uptake. Sadly, I never see anyone talking about it except alongside rails. And I never hear about rails anymore.

That being said I'm more on the backend side of things so it's not surprising that I wouldn't know the fronted stuff as much. So it could well be a thriving language. I hope so. It's very fun to use.

Python is far more ubiquitous though and it's also very fun.

3

emma wrote

I, the experienced web dev, would do this in PHP. My reasoning is:

  • It sounds like the big frameworks are completely overkill for this use case. PHP makes it super easy to make applications like these without a framework.

  • PHP runs as a daemon/is integrated into the web server, so there's no application server you have to manage yourself. Single .php file, drop in www directory, it's ready to go.

3

twovests OP wrote

Ooh I've seen two people recommend PHP so far here! My understanding of PHP was always that it was universally hated by everyone who ever used it, but the way you describe it actually sounds quite appealing.

2

twovests OP wrote

Django sounds appealing to me since I already love Python a lot. Phoenix appeals to me because of the name, and then I can tell people "Yeah I have a side project using Python and Phoenix" and it sounds really rad, like I'm a sorcerer in a fancy tower

2