I have a nodejs application where I am using graphql queries and mutations which are in template literal format.
I want to store all these template literals in one single file and access it from anywhere in the application.
The template literals should be immutable so that it doesn't get changed.
What would be the best way to do this nodejs.
A solution I found in stackoverflow is something like this.
class GraphqlLiteral {
constructor() {
}
static #query1 =`string literal template` ;
static getQuery1() {
return this.#query1;
}
}
I tried the above solution in my nodejs app in glicth but its says unexpected token #.