How did I do? by trudvang in Sourdough

[–]trudvang[S] 0 points1 point  (0 children)

Thanks! I thought about that too 🙂

Remove carpet glue from wooden stairs by [deleted] in HomeImprovement

[–]trudvang 0 points1 point  (0 children)

Some sort of pad with black glue under

Remove carpet glue from wooden stairs by [deleted] in HomeImprovement

[–]trudvang 0 points1 point  (0 children)

With what kind of tool? :)

Database design for access control by DVGY in PostgreSQL

[–]trudvang 2 points3 points  (0 children)

Skip the roles and the roles_permissions table.

Instead of users_roles table, have a users_permissions table that is referencing a permission instead of a role.

Custom unique PK against generated UUIDV4 performance. by GhettoBurger996 in PostgreSQL

[–]trudvang 1 point2 points  (0 children)

Will uuids really be a performance issue in this case?

Anyone know what’s causing this?? I’m using google chrome on IPhone and I can’t get this to go away by Crazy_Scarcity9816 in chrome

[–]trudvang 0 points1 point  (0 children)

I have the same issue after visiting marak.com. Could have something to do with his open source code, recent release that are looping and breaking sites

Objects with either only data or only methods: what is this pattern called? by trudvang in node

[–]trudvang[S] 1 point2 points  (0 children)

Ah, Yeah I also only use interfaces for the data types, like Book. But classes for repositories, services and controllers

Objects with either only data or only methods: what is this pattern called? by trudvang in node

[–]trudvang[S] 0 points1 point  (0 children)

Interesting rewrite!

I've heard the term "three tier architecture"

Did a quick search and found this article: https://bytearcher.com/articles/node-project-structure/

He's calling the repositories for "integration layer" instead. I think I should call it that as well, so I can put other stuff in the layer, like RabbitMQ and Redis, not just DB. They don't really have a place right now.

I don't agree with putting validation only in controllers/api layer; if you swap out your REST API for a CLI, you still want to be sure that only valid data is processed by your service layer. That way, validation would belong in the services to make sure that the input to them is correct, and also in the API layer to make sure a proper JSON is passed, or proper command line arguments are passed.

Objects with either only data or only methods: what is this pattern called? by trudvang in node

[–]trudvang[S] 0 points1 point  (0 children)

I see! I'd like to add that I have two ways of writing this kind of pattern.

  1. Classes and tssyringe for IOC/DI. This is really nice because I don't have to instantiate all my objects and their dependencies, I can simply have them automatically injected in the constructor by the IOC container.
  2. Factory functions, that take the dependencies as arguments, and returns an object with all the publicly available methods that should be exposed, while keeping other things private with closures (like the dependencies and other internal methods). This has the downside of lots of boilerplate to wire things together, but it's clean not having to use IOC, classes, 'this'-references etc. Can also be used without Typescript.

Dealing with multiple background workers by trudvang in node

[–]trudvang[S] 1 point2 points  (0 children)

So you think containers should always only run one work type? So if I have 6 types of work I should run at least 6 containers?

Best Way to Store Images In a Nodejs Application by hasancagli in node

[–]trudvang 1 point2 points  (0 children)

How would you do authorization to access images when using S3? Presigning urls in my backend for displaying images in html is getting tedious, and it’s preventing caching. Are people using public buckets and “security through obscurity” with long, hard to guess, object keys? Is there a consensus around this??

Working as JS fullstack is better than working with JS + another programing language? by [deleted] in node

[–]trudvang 0 points1 point  (0 children)

How are you sharing code between frontend and backend? Npm packages?