Skip to content

Latest commit

 

History

History

sample-kanban-node

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

sample-kanban-node

Application showcasing how to configure a postgresql database for testing purposes using TestContainers

Dependencies

There are a few others, check the package.json for details.

How to build

Download npm dependencies:

npm i

How to test

npm run test

How to run

Make sure you have a running postgresql available. There is a convenient docker compose file in the infrastructure folder that will provision the sample kanban database for you.

npm run dev

Noteworthy

  • Small but important reminder, this code is quite experimental and aims to showcase testcontainers, not the best Node.js practices. You where warned!
  • Unlike modern frontend development, we don't have a build step for code that runs on client-side. We're avoiding, however, download pure frontend artifacts and serve them as assets, because we might lose track of our dependencies, managed by npm. In spring version, there was webjars, so we did a similar approach using koa-static and koa-mount.
  • Koa's simplicity always amazes me. This is what express was supposed to be. Modular. Extensible. Easy to test.
  • Thanks to xo we have a simple way to have some code quality standards. Direct eslint configuration is quite unbearable and other linter alternatives seems too strict.
  • TestContainer setup is quite similar to what we saw on jvm version; it has, however, a distinct idiom to provide the init.sql script needed to create a known state in the database.
  • Always remember that everything that executes in a node project has the point of execution, entrypoint, you name it, in the same folder as the package.json, the project root in other words. This is why in the .withBindMounts call the path to sql script in the other project jumps just one folder up and not two. This is why koa-static doesn't need to jump up no folder when mapping the frontend libs in node_modules.