Skip to content
This repository has been archived by the owner on Sep 22, 2021. It is now read-only.

An Angular module for communication with a GraphQL Server

Notifications You must be signed in to change notification settings

lenneTech/ng-graphql-client

Repository files navigation

!!! deprecated !!!

This package is deprecated, please use @lenne.tech/ng-base instead. It contains all the features of @lenne.tech/ng-graphql-client and many more.


NgGraphqlClient

Angular GraphQL Client by lenne.Tech is a library for Angular to communicate with a server via GraphQL using Apollo Angular.

To use this library, an Apollo Server is required. If you don't use a server with such an API yet, we recommend our lenne.Tech Nest Server, which you can set up conveniently with our Starter.

This extension contains the following features:

  • GraphQL service and elements for easy communication with GraphQL API (via Models)
  • Standard Model with methods for mapping, cloning and comparing models
  • Basic User Model with basic rights handling
  • Authentication service for user registration
  • Loading Service for the subscription of loading processes
  • Storage Service for comfortable saving of data in local storage
  • and much more

Requirements

Integration into an Angular project

Installation

cd path/to/your/angular-project
npm i @lenne.tech/ng-graphql-client

Integration in your App Module (src/app/app.module.ts):

import { GraphQLModule } from '@lenne.tech/ng-graphql-client'
@NgModule({
  imports: [
      GraphQLModule.forRoot({
        apiUrl: 'https://url.to-your.domain/api',
        version: 'versionForLocalStorageKeys',
        prefix: 'prefixForLocalStorageKeys'
      })
  ],
})

Extend this library

This project was generated with Angular CLI version 11.0.4.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

Test the package

npm run pack

Afterwards, the package can be included in an Angular project as follows in the package.json on a test basis:

{
  "dependencies": {
    "@lenne.tech/ng-graphql-client": "file:/PATH_TO_PROJECT/ng-graphql-client/dist/graphql-client/lenne.tech-ng-graphql-client-0.1.7.tgz"
  }
}

Publish

Update version in projects/graphql-client/package.json and projects/graphql-client/package-lock.json.

After that, the new package can be published as follows:

npm run publish