I am not able to see my SPA page after deploying it to Azure WebApp from VS Code. Its says
"Hey, Node developers!
Your app service is up and running.
Time to take the next step and deploy your code."
I have seen at so may site that I need to set default document and New physical path. But i don't see any Default Document Tab in Configuration menu of Web App. There are only three tabs. 1- Application Setting 2- General Setting 3- Path Mapping.
The Issue is where to set the Default document and new physical path.
If you deployed to a Node Linux Web App the default document would be hostingstart.html located in /home/site/wwwroot/.
According this document:Things You Should Know: Web Apps and Linux, there is a description about default document in a Node.js app.
When you create a Node.js app, by default, it's going to use hostingstart.html as the default document unless you configure it to look for a different file. You can use a JavaScript file to configure your default document. Create a file called index.js in the root folder of your site and add the following content.
So go to your ssh terminal, navigate to /home/site/wwwroot , create the index.js with the following code:
var express = require('express');
var server = express();
var options = {
index: 'index.html'
};
server.use('/', express.static('/home/site/wwwroot', options));
server.listen(process.env.PORT);
Related
Inside a Firebase project called originalawesome I set up a second site on Firebase Hosting, then I have:
originalawesome.web.app
secondawesome.web.app
The first one (originalawesome) has a JS application in production.
In the second (secondawesome) I want to install a Flutter Web App and for this I am following the following steps:
firebase init
(I select Hosting)
(I select to use an existing project)
(I select the project - originalawesome) //secondawesome is not an option
There it asks me to select the directory to publish, so I suppose the Flutter Web application will publish on my site in production, which is wrong.
Reading the documentation in Share project resources across multiple sites , when deployments are to be made in different sites, the Deploy Targets are requested to be differential with the following command:
firebase target: apply hosting secondawesome secondawesome
However, when I run it I get an error because I don't have a firebase json file yet.
Error: Not in a Firebase app directory (could not locate
firebase.json)
The question is, How can I deploy a Flutter Web App on a second Firebase Hosting without deleting the previous one?
After a fair amount of trial and error the solution is as follows:
In the App Root Directory (it's very important):
flutter build web --web-renderer html //In my case, I will
//generate html web rendered. It will create a firebase.json
//file and others
firebase target:apply hosting originalawesome originalawesome
firebase target: apply hosting secondawesome secondawesome
//It will create records in .firebaserc file
In firebase.json file, you need to include:
{
"hosting": {
"target": "secondawesome", //deploy target
//(previously created on Firebase Hosting Console)
"public": "build/web", //build/web is the directory of the Flutter Web App build
///rest of file
Now yes, run...
firebase init
? What do you want to use as your public directory? build/web
? Configure as a single-page app (rewrite all urls to /index.html)?
Yes
? Set up automatic builds and deploys with GitHub? No
? File build/web/index.html already exists. Overwrite? No
To finish and upload the files to the Firebase Hosting ...
firebase deploy --only hosting:secondawesome
I hope it serves someone else!!
I am developing a chatbot using NodeJS and BotBuilder. I have the file chatbot.jpg stored in a folder named image. This sits just beneath the root directory. I am able to display the image (using Kudu to find the URL) in a web browser as follows:
https://mysite.scm.azurewebsites.net/api/vfs/site/wwwroot/images/chatbot.jpg
If I remove the .scm element within the URL, I can no longer display the image.
Even more curiously, if I use the above URL in my bot code, the image doesn't display.
var welcomeCard = new builder.HeroCard(session)
.title("This is the new")
.subtitle('Virtual Assistant')
.images([
new builder.CardImage(session)
.url("http://mysite.scm.azurewebsites.net/api/vfs/site/wwwroot/images/chatbot.jpg")
alt("Virtual Assistant")
]);
session.send(new builder.Message(session)
.addAttachment(welcomeCard));
My question is, how do I find out the regular URL of the image stored in the Azure App Service, so that I can use it in my code?
From the public web, the URL should be https://mysite.azurewebsites.net/images/chatbot.jpg
The wwwroot folder is the root folder served by the app service.
Your code can't just the scm URL as that URL requires you to be logged in to the Azure portal; it's an admin URL.
To accomplish your goal, you need to configure your Restify server to serve static files.
Example Restify config (add to your bot code):
server.get(/\/images\/?.*/, restify.serveStatic({
directory: './images'
}));
I have an < iframe > based Node-Red UI hosted inside MEAN application. I want to create a blank workspace each time I visit the Node-Red hosted Page without restarting NR server?
But I also need to preserve the previously deployed flows.
I've tried changing user directory to scratch :
var settings = {
httpAdminRoot:"/red/",
httpNodeRoot: "/api/",
userDir:"/home/sudo/.nodered/scratch",
functionGlobalContext: { } // enables global context
};
but it wouldn't work instead it started creating persistent flow file inside the scratch directory.
You can't do what you want with the default Node-RED. It will always store the flow in a file in the userDir
You will need to look at implementing your own storage module as described here: http://nodered.org/docs/api/storage/
I am using VS 2013 and MVC5
To host the application in IIS, i have used Properties-> Web ->Servers ->Local IIS and clicked on Create Virtual directory.
So this created a VD for "MyPortal"
But now i have a path problem.
I have an api controller in my application.
When i was using VS development server it was being accessed using the url : localhost:1553/api/menuapi and the data was getting accessed correctly.
But once it is hosted to IIS, it stopped working.
When checked, it is trying to fetch the data from url i.e :
localhost/api/menuapi and it gives a 404 error.
But actually the api is fine and the data is accessible from the url :
localhost/MyPortal/api/menuapi
Why and how is this path problem created?
The below is how i am doing the api call :
1. In javascript file :
$http.get('/api/menuapi/' + menuid).success(function (data) {});
Please suggest if any alternatives.
The problem is that your javascript will only works if the application is deployed on the top level of the webserver (/), as you are using an absolute url.
If your javascript is executed at the top level of your application, you could just change your url as relative:
$http.get('api/menuapi/' + menuid).success(function (data) {});
but if your javascript in a view, a better approach would be to retrieve the proper full url with:
#Url.Content("~/api/menuapi/")
like:
$http.get('#Url.Content("~/api/menuapi/")' + menuid).success(function (data) {});
As far as I understand from reading this snippet in this documentation regarding 'Defining dependencies':
will allow using any app to be used to meet the dependency.
sessions or sessions#* will match any app with the name sessions (such as the sessions app in the Foxx application store).
sessions#1.0.0 will match the version 1.0.0 of any app with the name sessions.
Foxx will look for any dependency with name 'sessions'. However, when I tried it locally, it seems like it tries to find any app mounted at /sessions rather than name 'sessions' and this error populated in the logs if I use like this format 'sessions#1.0.0':
[ArangoError 3007: Mountpoint can only contain a-z, A-Z, 0-9 or _.]: [object Arguments]
Is this an expected behaviour? I really hope if it's possible to import an app by name rather than the mount point though.
The blurb in the documentation refers to the value in the manifest.json file. Dependencies in the manifest are defined by an alias mapped to a string in the format of <name>#<version>. The exact meaning of that string is not currently enforced so it just serves as documentation for the app.
If you mount an app that has dependencies, you need to set up the dependencies (e.g. using the web frontend). The web frontend's dependencies dialog lets you enter mount paths of apps you want to use to meet the dependencies.
The code of the app itself will then be able to refer to the exports of the apps mounted at those paths by the aliases defined in the manifest.
For example:
You create an app called example with the following dependencies:
"dependencies": {"mySessions": "sessions#^1.0.0"}
You install a sessions app (e.g. the sessions app from the Foxx app store) and mount it at /my-sessions.
You install your example app and mount it somewhere else.
You open the app details of your example app in the web frontend and open the dependencies dialog (boxes icon in the top right).
The dialog should show a single input field titled MySessions with a help popup saying sessions#^1.0.0.
Enter /my-sessions into the input field and save.
Your example app should now be able to access the exports of the app at applicationContext.dependencies.mySessions.