This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import axios, { | |
| AxiosError, | |
| AxiosInstance, | |
| AxiosRequestConfig, | |
| AxiosResponse, | |
| InternalAxiosRequestConfig, | |
| } from "axios"; | |
| import { API_BASE_URI } from "../config/apiConfig"; | |
| import { ErrorResponse, FetchResponse } from "@sapience/common"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mkdir jsonbytes-monorepo | |
| cd jsonbytes-monorepo | |
| npm init -y | |
| npm init -y --scope @jsonbytes -w packages/core | |
| npm init -y --scope @jsonbytes -w packages/database | |
| nest new -g -s -p npm --directory packages/api @jsonbytes/api | |
| npm init -y --scope @jsonbytes -w packages/api | |
| npm install @jsonbytes/core -w @jsonbytes/api |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as fs from "fs/promises"; | |
| import * as path from "path"; | |
| // usage (compiled) | |
| // node dist/index-generator.js /home/jason/Development/project/src/moduledirectory | |
| const generateIndex = async (folderPath: string) => { | |
| try { | |
| const files = await fs.readdir(folderPath); | |
| const exportStatements = files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import axios, { AxiosError, AxiosInstance, AxiosRequestConfig } from "axios"; | |
| import { API_BASE_URL } from "../config/apiConfig"; | |
| class APIClient<T> { | |
| private axiosInstance: AxiosInstance; | |
| endpoint: string; | |
| constructor(endpoint: string) { | |
| this.endpoint = endpoint; | |
| this.axiosInstance = axios.create({ baseURL: API_BASE_URL }); |