From 975ab9e285baf4f1b22b60104db4f8f982c1db8b Mon Sep 17 00:00:00 2001 From: David Gay Date: Wed, 21 Apr 2021 20:59:17 -0400 Subject: New Rails project with pgsql --- app/javascript/channels/consumer.js | 6 ++++++ app/javascript/channels/index.js | 5 +++++ app/javascript/packs/application.js | 13 +++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 app/javascript/channels/consumer.js create mode 100644 app/javascript/channels/index.js create mode 100644 app/javascript/packs/application.js (limited to 'app/javascript') diff --git a/app/javascript/channels/consumer.js b/app/javascript/channels/consumer.js new file mode 100644 index 0000000..8ec3aad --- /dev/null +++ b/app/javascript/channels/consumer.js @@ -0,0 +1,6 @@ +// Action Cable provides the framework to deal with WebSockets in Rails. +// You can generate new channels where WebSocket features live using the `bin/rails generate channel` command. + +import { createConsumer } from "@rails/actioncable" + +export default createConsumer() diff --git a/app/javascript/channels/index.js b/app/javascript/channels/index.js new file mode 100644 index 0000000..0cfcf74 --- /dev/null +++ b/app/javascript/channels/index.js @@ -0,0 +1,5 @@ +// Load all the channels within this directory and all subdirectories. +// Channel files must be named *_channel.js. + +const channels = require.context('.', true, /_channel\.js$/) +channels.keys().forEach(channels) diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js new file mode 100644 index 0000000..f710851 --- /dev/null +++ b/app/javascript/packs/application.js @@ -0,0 +1,13 @@ +// This file is automatically compiled by Webpack, along with any other files +// present in this directory. You're encouraged to place your actual application logic in +// a relevant structure within app/javascript and only use these pack files to reference +// that code so it'll be compiled. + +import Rails from "@rails/ujs" +import Turbolinks from "turbolinks" +import * as ActiveStorage from "@rails/activestorage" +import "channels" + +Rails.start() +Turbolinks.start() +ActiveStorage.start() -- cgit v1.2.3