EddieHubCommunity/api

NestJS

eddiejaoude opened this issue ยท 7 comments

  • Create NestJS api project from CLI
  • Add GitHub Action for lint, prettier, build
  • Use NestJS CLI to create a new CRUD resource called discord with the generate command resource docs
  • Automated testing end-to-end with what NestJS recommend (remove unit testing)
  • Wrap automated testing in Cucumber
  • GitHub Action for automated testing
  • Create CRUD for member without DB
interface Member {
   username: string;
   bio: string;
   socials: {
      discord: string;
      twitter: string;
      linkedin: string;
      github: string;
   };
   updatedOn: Date;
   createdOn: Date;
}
  • Add Mongo DB for CRUD with typeorm docs
  • Add Swagger docs (there is a NestJS plugin)
  • Dockerise
  • Deploy to Digital Ocean

Notes for the future

  • Discord (username, total messages, total reactions, bio, social links)
  • GitHub (username, total commits, total replies, total issues, total PRs, total reactions)

@eddiejaoude Do we need Prettier as well in GitHub actions? We can make it run and format the files before every user commits and just add linting and build Action. What do you think?

Also, if we have prettier in GitHub Action, we will have to do one additional commit via GitHub Action right? When it format the files?

@khattakdev I would rather the Action does not change any files ๐Ÿ‘ so leave Prettier off the Action.

We could always add something like Husky later to run things locally before people commit.

Automated testing end-to-end with what NestJS recommend (remove unit testing)

I agree having automated e2e tests is beneficial, but I'd like to know the reason behind removing unit tests in favor or e2e?
Can't we have both ๐Ÿ˜ƒ?

Ahhh e2e vs unit testing, I have a video coming up about this subject, there is a place for both for sure but there are several considerations to be had

Yes ideally we should (and can) have both ๐Ÿ‘ . Unit testing definitely has the benefit of being able to test boundary conditions within the depths of the code. But I often seen when unit tests pass, but the product still does not work.

A good example is https://twitter.com/ThePracticalDev/status/687672086152753152

I think for now we should prioritise e2e tests, as the API is blocking a lot of other projects.

I think for the e2e testing on the API, we should use

  • chai / jest
  • supertest
  • cucumber

I will close this as we have more specific issues for remaining tasks