Short project description
Table of Contents
We are using eslint for linting. You can run a lint check:
task npm:run -- lintTo autofix based on defined rulset:
task npm:run -- lint:fixWe are using pre-commit. This is not mandatory, but you can enable the pre-commit hooks to avoid push unlinted/malformed code.
pre-commit installUsing the provided tasks, you can run npm commands within a Docker container to ensure compatibility and consistency across different environments.
To run an npm command inside a Docker container, use the npm task. This task reads the Node.js version from the .nvmrc file in the repository and runs the specified npm command inside a Docker container.
Basic usage:
task npm:<npm_command> -- [<args>]Examples:
-
Run
npm run build:task npm:run -- build
-
Run
npm ls:task npm -- ls
or
task npm:lsNote:
- You can use task command wildcards and arguments to run specific npm commands.
- Both
task npm:<command>andtask npm -- <command>are supported. - For instance,
task npm:run -- buildandtask npm -- run buildachieve the same result.
These tasks ensure that your npm commands run within the context of the Docker container with the appropriate Node.js version specified in the .nvmrc file.
task npm:installtask npm:run -- starttask npm:run -- devIf you want to run the project using your local Node.js instead of the dockerized one, you need to pick correct Node version by running:
nvm useThen it is possible turn on the dev server using:
npm run devtask npm:run -- build:gql-schemaThis will generate the types in the file ./src/schema/resolvers-types.ts.
Note:
Currently there are two graphql-modules present: books, heartbeat and scalars.
However, they only serve as an example on how to structure the source code and could be deleted be later.
⚠️ Please avoid unneccessary env bloat, there's a dedicated configuration file for everything else, see below.
| Name | Description | Default |
|---|---|---|
| NODE_ENV | available options are (development, production, test) | n/a |
| CONFIG_PATH | PATH to the configuration file to be loaded by the client in runtime (see below) | ./resources/configuration.yaml |
create the file resources/configuration.yaml and set your application configuration there.
---
app:
port: 4000
host: '0.0.0.0'
environment: 'PROD'
datasources:
booksApi:
url: http://some-url:3000All changes require a PR and review. Create a new branch and reference a Jira ticket, f.e.
git switch -c feature/INPRO-1-configure-resourceIn the future it would be nice to integrate Pothos, a plugin based GraphQL schema builder for typescript. It makes building graphql schemas in typescript easy, fast and enjoyable. An example application is available here