loading...

Going back to the simple functional web

codezed_ profile image Zeeshan M ・2 min read

Remember the simple times of PHP web, back in 2000s?

Each web URL was literally a #PHP file.
1 file serving 1 function. Simple, straight forward.

where prototyping was quick and fun. Sure, code quality wasn't the top priority but it allowed for rapid prototyping by literally anyone. Web was easy.

Your API was a file under /api/books.php and to make it look decent, developers would hide the ".php" from the url using htaccess. voila. one file per end point.

In 2020, if you're developing in NodeJS, chances are you use some library or boilerplate that has an MVC structure and everything needs to be configured before you can have your simple functionality that you wanted to test out your prototype.
even if you have a react Frontend ready,
you just can't start with a single file and with the bare minimum functionality.

but then this old simplicity of PHP is being brought back with FAAS and serverless. You can have a single file, having a single function, deploy it quickly and start prototyping.

I wanted to get this speed agility and rapid prototyping ability to my local setup.

So I built an experimental setup that I'm calling backwardsJS.
BackwardsJS goes back to a time where you could quickly "hack" a web tool together.

What is BackwardsJS?

It's a koa based boiler plate for hobbyist rapid prototyping

What can I do with it?

You can drop a simple file in your Fns folder
which becomes your web end point as well.

for example,
a function in hello.js file will be served if you call http://localhost:3433/hello

It can also do NextJs style dynamic routing by having a file structure like /api/todo/[id].js

Why?

Cause why not?
I wanted the simplicity of functions to serve my local web tools.

I'm looking for feedback on this experiment from the dev.to community on whether this is something you find interesting or not

You can get and try the crude boiler plate code from my github: https://github.com/negati-ve/backwardjs-koa-function-as-a-service

Cheers! :)

Posted on by:

Discussion

pic
Editor guide