0.3.1 • Published 2 years ago

anecdata-ngcore v0.3.1

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Welcome

A mini Angular library for creating components that interact with the Anecdata.org back-end. To use in your app, import it into your AppModule. Contact Cait for a developer key!

This library is just getting started, please open a bug report if you encounter any issues!

Roadmap

  • 0.x: Testing 👈 WE ARE HERE. THERE WILL BE BUGS
  • 1.x: Feature parity and replacement of internal Anecdata services
  • 2.x: Reactive forms, useful internal classes that can be shared across the website and app
  • 3.x: 🦝🪄?

Adding to your project

  • To install: npm install anecdata-ngcore --save
  • Add the library to your AppModule:
import { ApiService, AuthService } from 'anecdata-core';

@NgModule({
    imports: [
        //... your other imports go here
        AnecdataCoreModule.forRoot({
            // Include the configuration for the module, specifying how it will interact with the backend API:
            baseUrl: 'https://www.anecdata.org',
            appName: 'your-app-name-here',
            appVersion: '0.0.0',
            // Ask Cait for a key!
            apiKey: 'we-need-you-to-provide-a-key-so-we-can-make-sure-people-arent-jerks',
        }),
        // .. etc etc
    ]
})
export class AppModule {

}

... And then you can access the services in your components!

// Import from the anecdata-core library
import { ApiService, AuthService } from 'anecdata-core';

export class AppComponent implements OnInit {
    // Include the services you want in your constructor
    constructor(private apiService: ApiService, private authService: AuthService){

    }

    async logMeIn(email: string, password: string): Promise<void> {
        // Do something awesome
        const session = await this.auth.login({email, password}).subscribe(session => {
            console.log(session);
        }, error => {

        })
    }
}

Standard Angular-cli boilerplate below:

This project was generated with Angular CLI version 13.3.7.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4300/. The application 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.

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 a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.

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.

0.3.1

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.4

2 years ago