Flat Files Instead Of A Database

On Saturday, March 28th 2020, 6:36:51 pm by Lee Nattress

Flat files instead of a database

What I'm working on

I'm working on the API of museful.

I've solved a problem

Reading and creating markdown files in nodejs.

app.post("/musings", async function(req, res) {
  try {
    if (req.body.title && req.body.content) {
      const id = await createMusing(req.body);
      res.json({ status: "ok", id });
    } else {
      throw "title and content are required";
    }
  } catch (error) {
    res.status(500).send({ status: "heck", error });
  }
});

Lessons learned

It is possible to create an API that does not have a database behind it, but merely any other kind of store. In this case, I can CRUD text files that are in fact markdown.

We expose this functionality though a REST api, and it looks like we are dealing with a data service or some kind, but actually, its just files.

museful code blogging profile image
museful code blogging

museful is a terminal application and web interface that lets developers on a project have more meaningful discussion with anybody interested in the source code than just commit messages.

Recent

Why Museful Exists

Monday, April 13th 2020, 12:42:12 pm

by Lee Nattress

Tidy Up For Releasable Version

Monday, April 13th 2020, 8:00:26 am

by Lee Nattress

What Is Museful?

Sunday, April 12th 2020, 12:26:39 pm

by Lee Nattress

Refactoring

Sunday, April 12th 2020, 8:07:23 am

by Lee Nattress

Npm Package!

Saturday, April 11th 2020, 8:33:48 pm

by Lee Nattress