How does NSwag works in ASP.Net Zero framework? - asp.net-core-2.0

I tried working on an ASP.Net Zero and it works and I have used its built in PowerTools to create CRUD functionalities of the system. And I tried adding some manual front-end Angular UI in the client side of the application. I'm just not sure what will happen if I run the "refresh.bat" command in NSwag if it will erased all of my manually created UI and service proxies. Please help me.

Create a git branch and examine changes after you try it. Discard all if not acceptable.

Refresh.bat will update and generate service proxy for implemented api on .Net backend.
Always let your Api server running whenever u want to run refresh.bat.

Related

IIS/ASP.Net vs NodeJs/ExpressJS

I'm very new to NodeJs/expressJs, i read tons of articles on internet and still don't understand it
is NodeJs a web server like IIS ? if so can i host an asp.net app in NodeJS ?
Is expressJs a framework like ASP.NET ?
I currently work on both IIS ASP.NET applications as well as NodeJS/ExpressJS systems and the below is what I have noted to be different:
IIS:
Windows server based
Can have strict setups such as MVC etc
Built in deployment that compiles the entire website
Setup can take quite some time to create all modals and get all
plugins working etc
Services can take some time setup and modal mapping can be tedious
NodeJS/ExpressJS:
Not Windows based. I run this typically on an Ubuntu server with
Nginx to push the domain to the public
Easy to setup and fast to get something basic online
Does not natively compile and runs files as they are
Uses npm package manager with easy to install packages
Does not have strict setups but you can technically create your own
MVC style system
Code can quickly become messy however with the correct approach you
can manage the amount of code easily.
NodeJS is not a web server. It is a backend server (Such as a REST API etc)
ExpressJS sits ontop of NodeJS to add functionality and is essentially a framework. Coupled with jade/pug you can write js inside the html.

React.js - How to deploy client and server independently or together?

I have a react.js website with a backend in Node/express hosted on Azure, right now the project is monolithic, every time I do a change in the front or backend everything is redeployed in production. What I would like to achieve is to be able to deploy the frontend and the backend independently from one another whenever I push a change on github, but also if they are both affected deploy them together to avoid inconsistencies. Do you know some best practices or services to achieve this? Thanks
The git deployment method of Azure app services is simple. However, as long as we modify the file, all deployment commands will be executed and the entire deployment process will start. This cannot be changed.
Based on your description, I probably know that your project is a fusion of front and back ends, without separation of front and back ends. So I guess, you want to use the same app services for the front-end app and the back-end app.
So I suggest that you still separate the front and back ends of the project. This is the mainstream. It is also convenient for later maintenance and expansion. If you just want to use a webapp service, you can use a webapp based on the windows environment, and just use a virtual application. In this way, the update program can be completely separated without any impact.
Note that at present I found that the virtual application does not support the react project and has raised a support ticket to confirm. If have any progress, I will tell you.

500 error when I try to deploy nextjs ssg application with incremental-static-generation

I have NextJS app with SSG. This functionality was added recently and according to it I should do next-export after next-build to get static files. But after appearing in 9.4 of Incremental Static Regeneration I need to keep server on by npm-start command (in my case I use custom server file with next-express functionality). It works good locally and It works good when I get artifact from Azure. But It doesn't work globally when it will be deployed finally. Help please
Through my attempts, I found that it is impossible to install globally or use next in Azure Web App. That is, it cannot be deployed through Github.Deploying using other methods such as FTP cannot run successfully. It should be related to the azure node environment.
But the method provided in this post says that it can be processed by adding web.config. I think it should be useful and helpful to you. Please read it carefully and try it.
You also can read this document, maybe it useful to you.

Read Azure App Settings in Angular4 CLI

I have an Angular4 web app, deployed on Azure. Now I want to deploy this app to other environments on Azure: one for testing, one for acceptance and one for production. Every environment has different API endpoints and may have other variables, like Application Insights. All those environments run Angular in production mode.
The way Angular advises you to do this, is by the Enviroment files (environment.test.ts, enviroment.acc.ts, environment.prod.ts). I could configure all the different API endpoints in those files, and run my build with --prod for production for example.
But that is not the way I want to do this. I want to use the exact same application package deployed to test for my acceptance environment, without rebuilding the project. In Visual Studio Online, this is also really simple to configure.
The point is: how can I make my API endpoints differ per environment in that way?
The way I want to do this, is by the App Settings in Azure. But Angular can't get to those environment variables because it's running on the client side. Node.js is running on serverside and could get those App Settings - but if that's the way I need to do it, how do I make Node.js (used in Angular4 CLI) to send those server variables to the client side? And what about performance impact for this solution?
How did you fix this problem for your Angular4 apps on Azure? Is it just impossible to fix this problem with the Azure App Settings?
For everyone with the same question: I didn't fix this problem the way I described above.
At the end, I did it the way Angular wants you to do it: so rebuild for dev, rebuild for acc and rebuild for prod.
In Visual Studio Online, at build time, it builds and tests our code and it saves the uncompiled/unminified code. At release time, it builds en tests it again and releases it to the right environment with the right environment variables (--prod for example).
I don't think there is another way to fix this.
The solution is pretty old school but it works! Although you can use branching or tag for this purpose instead of cloning the code to the package.
The best solution as you said is Azure app settings will be saved as environment variable so you should implement an API with node.js and share the variables you want.
Of course there is an impact because of additional http call, but it's just one time at application start which is about max 5ms and depends on each program policy whether is impact or not.
Another option could be move the variables to the JSON file in the asset folder, and change it at deploy runtime with release pipeline. that's easier implementation but the disadvantage is you will have to use release variables instead of app settings and if you have config changes you will have to update the variable value first and redeploy it, although that works most of the times but sometimes you want to change just like a connection string and you will have to redeploy.

Using Nodejs with IIS for REST service using Express

We're using Nodejs + Express to create a RESTful web service. During testing we kicked off the service via the command-line, i.e., node mim.js and and tested the service using http://server:9999/mim/GetEmployeeData and that works fine.
The node application lives in inetpub\wwroot\myapps\mim and we want to be able to access it like so:
http://apps.mydomain.com/mim/GetEmployeeData
We're not quite sure how to get this to work with IIS, however. Looking for some help with respect to this.
Thanks in advance!
See this Hosting node.js applications in IIS on Windows tutorial:
https://github.com/tjanczuk/iisnode
It explains many different scenarios and since you din't post a lot of details it's hard to give you a more detailed answer other than pointing you to a good documentation about the thing that you're trying to do.

Resources