Does every backend need to be an API?

Jasterix - Jan 12 '20 - - Dev Community

At the Flatiron school, every project went through the same process: use rails to create a REST API and create a separate repo for you front end (in vanilla JS or React), which makes sense with the MVC design pattern.

But as I sat at my computer (finally back in working order) today, I've found myself unable to kickoff my first Node.js project. Not only do I not have rails new to get things started, but I have absolutely no idea of how to start the project. This made me start questioning how I've been doing things all along.

To offer some background, I want to create a Pomodoro single page application similar to the Marinara Chrome extension, which I currently use. This project would use vanilla JS, Postgres (if hosting on Heroku), Node.js/Express.

As I mentioned the Flatiron way would be to:

  1. create 2 repos- frontend and backend
  2. set up the backend as a REST API for CRUD actions
  3. use the Fetch API to connect your frontend to your backend

Considering this isn't a CRUD app, is creating my backend as an API still the best approach? Aside from MVC, how would you structure a relatively small project like this? I've read into other design patterns, but still unsure.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player