How to run the AngularJS Tutorial from Google? - angularjs

I've found this to be a very useful tutorial so far, probably one of the best step by step guides ever created for programming as EVERY SINGLE STEP is seen committed via GitHub:
http://docs.angularjs.org/tutorial/the_end
I hit a brick wall towards the middle and I can't host a json object on a Microsoft IIS server I have provided by GoDaddy. I have to edit my web.config file because Microsoft apparently thought it was a great idea to throw a 404 on the URL of a pure JSON object:
http://cinicraft.com/angular/phones/phones.json
So that's a valid URL according to my FTP browser, but yeah I get a 404. Microsoft is brilliant in using the "not found" error exception with a file that exists.
And so I can't really go any further with the tutorial, I've decided to try running the completed version Google has available on GitHub, but I have no idea on how to run this:
۩/partials/
۞/phone-list.html
۞/phone-detail.html
۩/js/
۞/jquery.js
۞/controllers.js
۞/app.js
۞/angular.min.js
۞/bootstrap.min.js
۩/angular
۞/angular-route.js
۩/test
۩/phones
۩/fonts
۝/index.html
If I just open index.html straight from my finder on Chrome I only see a blank page, how does one run this AngularJS app?
Is node.js required?

Please look at the url https://github.com/angular/angular-phonecat and Prerequisites

Go to applicationhost.config file in your IIS config folder and add the following where similar mime types are defined
<mimeMap fileExtension=".json" mimeType="application/json" />
If still not allowed go to <requestFiltering> section and add the following
<add fileExtension=".json" allowed="true" />

Related

Added file To Public Folder in React - Get 404 [duplicate]

I published a json file on to my website using ftp. When I tried to access my site using mtsite.com/abc.json it throws the below error.
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
My file is on hosted site on azure. Even if file in on server why did it say that file is not found?
Any place in azure portal where I can add or allow Mime type json? I cannot add web.config file as My files are all HTML and Json.
By default IIS (and so the Azure App Service) doesn't serve .json files. You need to enable this feature in your web.config. If don't already have one, create it in the root directory.
Open your web.config and place this code
<staticContent>
<remove fileExtension=".json"/>
<mimeMap fileExtension=".json" mimeType="application/json"/>
</staticContent>
under the nodes
<configuration>
<system.webServer>
And it should be fixed.
Here you can find a basic web.config template that i've made a while ago
P.S: Even though you are using only HTML and JSON, this is the only way to go (as there is not a UI solution in the portal). In this way you could also control other aspect of your website, for example the redirect to HTTPS for the HTTP requests.

CRA Service worker not working in production

Hello and thanks in advance for any help. I got a service-worker up and running with my react-app, it runs perfectly on local builds and when deployed from Azure pipelines as well. Problem is in production, which is deployed via Cloudflare, the service worker throws this error in console and cannot figure out why: "Uncaught (in promise) bad-precaching-response: bad-precaching-response :: [{"url":"https://example.com/static/media/getFetch.xxxxxxxxxxxxx.cjs","status":404}]"
Now the said file "getFetc.xxxx.....cjs" seems to be there under static/media/ build files
Any suggestions would be welcome!
reason being "getFetc.xxxx.....cjs" this is a static file so you have to mention a rule in your web.config file ,so that this particular file is processed.
Add following line in your web.config file :
<staticContent>
<mimeMap fileExtension=".cjs" mimeType="text/javascript" />
</staticContent>
Hope this will help you..!
Ok, problem solved, and in our case it was actually an error in the server not serving the file whne requested, so apparently nothing was wrong client-side

Angular app on Azure Web app fails with "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."

I just published an Angular app to Azure Web Apps, after confirming general operation locally. However, I now get the following error (HTTP Error 404.0 - Not Found), specifically the D:\home\site\wwwroot\bin\www file:
However, using the Kudu tools, I can see that the file is indeed there:
What could cause this error?
By default, IIS blocks serving content from certain folders, including bin. You can either a) move the www folder out of the bin directory, or b) you could add the following configuration to the web.config:
<configuration>
<system.webServer>
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin" />
</hiddenSegments>
</requestFiltering>
</security>
</system.webServer>
</configuration>
The 404.0 Error on bin\www was a bit of a misdirection. After putting a console.log in the www file and watching output, I found out that indeed bin\www was being called properly. The problem was further in and related to the serving of static content, initially the index.html file.
I was previously using the following to serve up index.html:
var serveStatic = require('serve-static');
...
app.use(serveStatic('.', { 'index': ['index.html'] }));
For some reason, while this worked locally, this didn't work once published to Azure Web App. So I decided to use a method that had worked for others. First I moved index.html to /public, and then used express.static:
app.use(express.static(__dirname + '/public'));
It should also be noted, that the associated web.config file must also have information related to the static content, for example: How to enable static files (and less support) when hosting a nodejs app within IIS using IISNode

angular js path returns 404 error when https is used

Please keep in mind, I have not worked with angular JS, nor did I write the code that is causing the error.
I am getting an 404 error on this path:
https://www.helivalues.com/Su6UsWuf/bb/option/mfg/all
but not this path:
http://www.helivalues.com/Su6UsWuf/bb/option/mfg/all
It was noticed that when a user views a certain page in https, the drop down does not load options. Angular Js makes a call to the path mention above which is not an actually file but is used by a php file that based on this path, has a switch that fills in the drop down.
Any ideas on how to get the https version to work? This is on a joomla site and I do have access to the htaccess file if needed. I really just need it to work for a few months while I work on building a new site.
Thanks!
Angularjs is not the issue. Your webserver (Apache/2.2.15 (SuSE) Server at www.helivalues.com Port 443) states the file can not be found. So it looks like something is misconfigured with your apache site.

Unable to download mp4 from sharepoint 2010 on mobile, but non-mobile works fine

We've got a SharePoint site with a custom application that is designed for both web and mobile that we are trying to upgrade from SP2007 to SP2010. The site contains playlists of mp4 files. We have asp.net session state active on the site for use within the custom application. We also rewrite urls to HTTPS.
The files are stored on disk and accessed through a virtual directory.
When the files are accessed through the SP2010 web site (non-mobile), the mp4 file plays just fine.
When the exact same url is accessed from a mobile browser, we receive the message:
Session state can only be used when enableSessionState is set to true, either in a
configuration file or in the Page directive. Please also make sure that
System.Web.SessionStateModule or a custom session state module is included in the
<configuration>\<system.web>\<httpModules> section in the application configuration.
We DO have the SessionStateModule declared in <configuration>\<system.webServer>\<modules> as follows:
<add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="" />
We have also tried without the preCondition, and with preCondition="integratedMode".
An example of the url is https://example.com/Assets/Job63/8f9e85d5-d7f3-4536-a9b1-69537b7da9bf/Previews/0568145f-b314-4354-a081-d72019a42d11.mp4 (the domain has been changed to protect the innocent).
The virtual directory is /Assets and it points to a c:\Assets directory.
This behavior occurs even using FireFox and changing the user agent to simulate mobile, so it appears to be something intercepting mobile requests.
None of the other sessionstate answers on the site appear to cover this problem.
We also have the SessionStateModule declared in the IIS Module list for the website.
What may be causing this problem?
We were able to resolve the issue by putting a web.config file containing the following into the assets folder. It is apparently the aggressive mobile redirect that SharePoint does in SP2010 that causes the problem, as explained at the following url - http://blog.mastykarz.nl/inconvenient-sharepoint-2010-mobile-redirect/ .
web.config contents:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<browserCaps>
<result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<filter>isMobileDevice=false</filter>
</browserCaps>
</system.web>
</configuration>

Resources