npm init -y
npm i express
npm i -D typescript tsx @types/node @types/express
npx tsc --inittesting libraries
npm i -D vitest supertest @types/supertest mswinstalling mogan middleware for request logging
npm i morgan
npm i -D @types/morgantsconfig
- either use
NodeNextfor module and module resolution with no bundler - or use a bundler (like
esbuildortsup) and set module toESNextand module resolution tobundler - using a bundler will allow you to use relative imports without file extensions but will add an extra build step
- app structure:
- routers (route groups)
- morgan (logging middleware)
- 404 not found middleware
- Error-Handler
- run
npm run test
- built a simple API using Express.js
- learned how to create unit tests using vitest and supertest
- explored multiple linting tools and fixed linting problems
- wrote my first GitHub Workflow
- learned that a workflow consists of jobs and each job can have multiple steps
- read what is continuous integration | Atlassian
- learned that integration tests can be between my API and a Database, message queue, or another API
- in this case, my API uses the OpenSenseMap (OSEM) API
- so I should test how my API behaves given different behaviors from OSEM API
- used Mock Service Worker (msw) to mock OSEM API
- wrote integration tests using vitest and supertest
- wrote a smoke test: which tests my application behavior with the real OSEM API not a mocked one
- installed kind
- created an ingress-ready configuration with 80/443 ports mapped
- apply Ingress-Nignx using
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml - wait until the controller is ready using this command:
kubectl wait --namespace ingress-nginx \
--for=condition=ready pod \
--selector=app.kubernetes.io/component=controller \
--timeout=90s- read Best practices when adopting continuous integration
- read GitHub actions secure use to know how to use third-party actions securely
- learned about CI/CD pipeline security measurements
- learned about code coverage, SonarQube, and static code verification
- learned not to use npx in CI pipeline and replace it with npm scripts for security reasons
- learned about container registries
fix: other updates to Vitest, SonarQube configs, and CI workflows