| branch prefix | desc | touches prod code |
|---|---|---|
| +:refs/heads/(feature/*) | add new feature | Y |
| +:refs/heads/(fix/), +:refs/heads/(hotfix/) | bug fix | Y |
| +:refs/heads/(refactor/*) | change code.e.g. renaming a variable | Y |
| +:refs/heads/(docs/*) | changes to docs | N |
| +:refs/heads/(style/*) | formatting, missing semi colons | N |
| +:refs/heads/(test/*) | adding missing tests, refactoring tests | N |
| +:refs/heads/(chore/*) | updating build scripts | N |
Say you have a class named AbcClass.
If AbcClass depends on AnotherClass, and AnotherClass eventually needs to make a network call (e.g. to S3, Databse, GIS, some other party), then don't instantiate AnotherClass inside AbcClass.
AnotherClass should be injected into the constructor of AbcClass.
Say AnotherClass is instantiated inside AbcClass.
When you write a test for AbcClass, AnotherClass will inevitably make a network call.
// npm install date-fns date-fns-tz
import { fromUnixTime, } from 'date-fns';
import { utcToZonedTime, format as utcFormat } from 'date-fns-tz';
// Unix epoch timestamp is a string in milliseconds in UTC
const unixTimestampString = '1692761130000'; // 2023-08-23 03:25:30.000ZSay you want to parse this date: 2023-05-31 T06:52:03Z.
Note: This date is non-standard as it has a space between 31 and T
// npm install date-fns date-fns-tz
import { parseISO } from 'date-fns';
import { utcToZonedTime, format as utcFormat } from 'date-fns-tz';It's preferable to create an Axios instance in node.js. Why? Because it offers several advantages over using Axios directly. It provides a more flexible, organized, and maintainable way to manage HTTP requests:
When you create an instance, you can set default configurations like base URL, headers, timeouts, etc., that will be applied to all requests made using that instance. This eliminates the need to specify these settings for each request.