Nothing Special   »   [go: up one dir, main page]

Skip to content

📋 App to pass real-time data using pusher-js API data streaming. From Pusher.com tutorial BUILD A REALTIME TABLE WITH ANGULAR by Christian Nwamba (see readme link)

Notifications You must be signed in to change notification settings

AndrewJBateman/angular-datastream-table

Repository files navigation

⚡ Angular Datastream Table

  • App with realtime communication between app and server using a websocket-based Pusher channel for notifications/updates etc.

*** Note: to open web links in a new window use: ctrl+click on link**

📄 Table of contents

📚 General info

  • The pusher channel uses a publish/subscribe model so all subscribers to the channel will receive the update. See Pusher documentation for more information.
  • The server.js file follows the Twelve-Factor methodology for building software-as-a-service apps that:

'Use declarative formats for setup automation, to minimize time and cost for new developers joining the project; Have a clean contract with the underlying operating system, offering maximum portability between execution environments; Are suitable for deployment on modern cloud platforms, obviating the need for servers and systems administration; Minimize divergence between development and production, enabling continuous deployment for maximum agility; And can scale up without significant changes to tooling, architecture, or development practices.'

📷 Screenshots

Example screenshot

📶 Technologies

  • Angular v15
  • rxjs v7 observable streams for asynschronous programming.
  • Pusher-js v8 Real-time communication scalable features.
  • Bootstrap v5. Links added to angular.json "styles"
  • NgAlert v2 alert component with different types of alert. Link added to angular.json "styles".

💾 Setup

  • Install dependencies using npm i
  • Get your own API key and Cluster name from Pusher-js Sandbox Plan
  • Add Pusher API Key etc. to .env file
  • Add API_KEY & CLUSTER values to environment.ts & environment.prod.ts
  • Run ng serve for a dev server. Navigate to http://localhost:4200/
  • Open a second command terminal
  • Install nodemon globally if you don't have it already
  • Run nodemon server.js to run the server backend. Navigate to http://localhost:2000/. Restarts with changes
  • 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.

💻 Code Examples

  • Function to delete an employee record with alert message before using the '_actualDelete' function.
  delete(employee: IEmployee) {
    // show delete confirmation with ngAlert
    this._ngAlert.push({
      message: `<strong>Are you sure!</strong> you want to delete this employee with name <strong>${employee.name}</strong>`,
      type: MessageType.warning,
      buttons: [
        {
          label: 'Continue',
          action: () => {
            this._actualDelete(employee);
          },
          css: 'btn btn-danger'
        }
      ]
    });
  }

🆒 Features

📋 Status & To-Do List

  • Status: Working front and backend. UI adds employees to the list. Employees can be added & deleted successfully but the edit component is not coded so not possible to edit employee records.
  • To-Do: Look at employee edit function. Customise app and add functionality. Consider currency pull-down menu for salary input.

👏 Inspiration

📁 License

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

✉️ Contact

About

📋 App to pass real-time data using pusher-js API data streaming. From Pusher.com tutorial BUILD A REALTIME TABLE WITH ANGULAR by Christian Nwamba (see readme link)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published