AndrewJBateman / angular-tailwind-dataportal

:clipboard: Angular used with Tailwind to create simple frontend to display backend data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

⚑ Angular Tailwind Data Portal

  • Angular app using TailwindCSS components & Angular Signals to display backend data
  • Note: to open web links in a new window use: ctrl+click on link

GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

πŸ“„ Table of contents

πŸ“š General info

  • Data shown on a grid of Tailwind-styled cards
  • Angular Signals used to track the state of changing backend data so rendering can be optimised.
  • Any JSON data object made available on localhost:3000 can be displayed on the Angular frontend. It is easy to modify the frontend Typescript model and HTML markup to match the JSON object on the backend. I used drug product JSON data as test data - see db.json

πŸ“· Screenshots

Angular page

πŸ“Ά Technologies

πŸ’Ύ Setup

  • Run npm i to install dependencies.
  • This frontend requires a backend data source - see /models/pharma.data.ts for format, on port http://localhost:3000
  • npm run server to run fake backend. Navigate to http://localhost:3000/api to see data object.
  • 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.

πŸ”§ Testing

  • Fake databse data in db.json used to test frontend.

πŸ’» Code Examples

  • 'data.service.ts' function to return data array Observable with fetch status and catch errors
loadData(): Observable<State<Array<IPharmaData>> | State<null>> {
    return this.http.get<Array<IPharmaData>>(`${environment.API_URL}/api`).pipe(
      share(),
      map((data) => {
        return new State<Array<IPharmaData>>(
          StatusNotification.OK,
          data,
          null
        );
      }),
      catchError((error: HttpErrorResponse) => {
        return throwError(
          new State<Array<IPharmaData>>(
            StatusNotification.ERROR,
            undefined,
            error
          )
        );
      })
    );
  }

πŸ†’ Features

  • Tailwind build for production CSS purge results in a very small styles bundle (about 7kB)

πŸ“‹ Status & To-Do List

  • Status: working
  • To-Do: Nothing

πŸ‘ Inspiration

πŸ“ License

  • This project is licensed under the terms of the MIT license.

βœ‰οΈ Contact

  • Repo created by ABateman, email: gomezbateman@gmail.com

About

:clipboard: Angular used with Tailwind to create simple frontend to display backend data


Languages

Language:TypeScript 65.2%Language:HTML 19.3%Language:JavaScript 14.5%Language:CSS 1.0%