Phoenix Js and Audio files adding - javascript

I am new in elixir development. I have couple sounds and js files which I add to my assets folder. When I am trying to access them I got an error
GET http://127.0.0.1:4000/js/calls.js 404 (Not Found)
call:1 GET http://127.0.0.1:4000/sounds/ringtone.wav
call:1 GET http://127.0.0.1:4000/sounds/ringbacktone.wav 404 (Not Found)
call:1 GET http://127.0.0.1:4000/assets/sounds/dtmf.wav 404 (Not Found)
call:1 GET http://127.0.0.1:4000/assets/sounds/ringtone.wav 404 (Not Found)
call:1 GET http://127.0.0.1:4000/assets/sounds/ringbacktone.wav 404 (Not Found)
call:1 GET http://127.0.0.1:4000/sounds/dtmf.wav 404 (Not Found)
But the sound files already in assets folder and conn.js also in js folder. This is sample code how can I connected call.js to html
<script src="<%= static_path(#conn, "/js/call.js") %>"></script>
From the book which I read I understood that if I want to make task management in phoenix for creating app.js I should need to use brunch. But in my situation I want to use javascript and sound files as seperate without task manager. My first question how can I access to javascript and sound files in phoenix? My second question as you can from the error list above it tryed to access to twice dtmf.wav file and other files. But inside of the html code I wrote this in one place why it tried to check this in two folders?
call:1 GET http://127.0.0.1:4000/assets/sounds/dtmf.wav 404 (Not Found)
call:1 GET http://127.0.0.1:4000/sounds/dtmf.wav 404 (Not Found)

In your endpoint.ex file, i believe you need to add the folder of your sounds.
lib -> AppName -> endpoint.ex
plug Plug.Static,
at: "/", from: :heaped, gzip: false,
only: ~w(css fonts images sounds js favicon.ico robots.txt)
If sounds is the name of the folder. :-)

Related

GET http://localhost/website/src/node_modules/three/build/three.module.js net::ERR_ABORTED 404 (Not Found) when importing THREE JS

I am trying to get threejs to work.
I am using a XAMPP server with the current directory structure:
.src/main.js looks like this:
import * as THREE from './node_modules/three/build/three.module.js';
But I keep ge
When launching index.html, I seem to be getting this error: GET http://localhost/website/src/node_modules/three/build/three.module.js net::ERR_ABORTED 404 (Not Found)

How can i get input data from a form in node.js?

Working on a weather application in node.js But when i tried to get the input value through document.getElementById to show weather about a specific location it is showing error
i have a file in my views folder where i provide JavaScript file using script tag but even then I am getting error.
error is given below:
GET http://localhost:3000/js/JavaScript.js net::ERR_ABORTED 404 (Not Found)
It is due to the fact that you are not serving a static files in your nodejs server. If you are using express server in your application you have to give the below code in main server js file
app.use(express.static('public')) here public means the folder where you have html, js folder, css folder

Blazor Webassembly client fails to load pushNotifications.js in referenced project

I'm attempting to implement push notifications in a reminder app I'm building. I am attempting to follow along to the way it is done in this demo project. To that end, I added a razor class library project entitled BlazorReminders.ComponentsLibrary to my BlazorReminders solution. Just as the BlazingPizza project did, I put the localStorage.js and pushNotifications.js files under the wwwroot folder of the ComponentsLibrary project. I then added a reference to the ComponentsLibrary in the client project and attempted to load the resources in the client's index.html file as follows:
<script src="_content/BlazorReminders.ComponentsLibrary/localStorage.js"></script>
<script src="_content/BlazorReminders.ComponentsLibrary/pushNotifications.js"></script>
This is the exact way they did it in the demo project, however for me it returned a "Failed to load resource: the server responded with a status of 404 ()".
A more detailed console message
GET https://localhost:44304/_content/BlazorReminders.ComponentsLibrary/pushNotifications.js net::ERR_ABORTED 404
I've also tried changing the src path to variations of "..\BlazorReminders\BlazorReminders.ComponentsLibrary\wwwroot\pushNotifications.js" to no avail; I got the same errors.
What could be causing the 404? Thanks
EDIT: Resolved
Thanks to agua from Mars for pointing out that I had forgotten to update the these package references in my ComponentsLibrary project file
//Version had to be changed to 3.2 preview
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.2.0-preview2.20160.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.2.0-preview2.20160.5" />

Failed to load resource: the server responded with a status of 404 (Not Found) javascript/application.js

Running my ROR app with Puma locally. Getting the following error trying to load javascript/application.js
Failed to load resource: the server responded with a status of 404 (Not Found) javascript/application.js
Keep in mind this was a Ruby 1.9.3 app that I just updated the GEM file to 2.3.1
Does anything need to be changed when running a Rails app locally?
The source code shows
<script src="/javascripts/application.js"></script>
<link href="/bootstrap.min.css" rel="stylesheet">
<link href="/bootstrap-responsive.min.css" rel="stylesheet">
Locally, javascript files should be under app/assets/javascripts. They will be compressed, minified and copied into public during assets compilation (deployment)
Looks like there's no js files under /public/javascripts hence the 404 error you are getting.
It's also worth checking that you are starting the app in development mode. Otherwise, rails will look into public for js and css files.
See https://guides.rubyonrails.org/asset_pipeline.html#asset-organization for more details.
As I can see in my projects there is this kind of path
/assets/js/...
but maybe earlier was diffrent convetion.
Do you use static assets or dynamic on local ?

Javascript files 404'ing in my Sinatra app on Heroku

I have been developing a small app with Sinatra. Locally it works fine but when I deploy it Heroku my JavaScript paths seem to break and I have no idea what is causing this.
My directory set up is I have a "assets" folder in the root of my application with separated folders for both scripts and styles. The scripts folder has a few subdirectories. I have set my public folder in Sinatra using:
set :public_folder, __DIR__ + '/assets'
My styles work correctly and I am drawing a blank on what the problem is. Also worth noting I am using requirejs to load my JavaScript.
Here is the output from the console:
GET http://evening-hamlet-5644.herokuapp.com/scripts/utils/libraries/jquery.js 404 (Not Found) require.min.js:1884
GET http://evening-hamlet-5644.herokuapp.com/scripts/utils/templating/hogan.js 404 (Not Found) require.min.js:1884
2
Uncaught Error: Script error
http://requirejs.org/docs/errors.html#scripterror require.min.js:194
GET http://evening-hamlet-5644.herokuapp.com/scripts/utils/libraries/lodash.js 404 (Not Found) require.min.js:1884
Uncaught Error: Script error
http://requirejs.org/docs/errors.html#scripterror require.min.js:194
GET http://evening-hamlet-5644.herokuapp.com/scripts/utils/libraries/pusher.js 404 (Not Found) require.min.js:1884
Uncaught Error: Script error
http://requirejs.org/docs/errors.html#scripterror
Any help or a kick in the right direction would be great.
Thanks
You could run a console with the heroku toolbelt (something like heroku run bash --app <your app name>) and verify if you have your JS files up.
Greetings!
I'm not a Sinatra hacker, but I don't find any DIR in their docs. Try setting DIR to
File.dirname(__FILE__), which I do see in their docs
It would help if you posted the Sinatra code that renders the links to the javascript files (ie. haml views etc).
However, without the code, I have a feeling it may be because you should be using Sinatra's url helper. If that's not it, and you post your code, I'll take another look.

Categories

Resources