I develop an application in Angular 2, mongoose, gulp and node.
What hosting service could you use?
What are the steps to mount an application of this type on a hosting server?
Thank you very much!
I recommend using Webpack for handling hosting.
With Webpack it is easy to setup different environments (dev, prod) with many configuration options. It provides a development server and many options to prepare your app for hosting. It supports tree-shaking (dramatically reduces the size of your application) and manages all the loading of your assets.
Hosting depends on your country. You can theoretically use any provider. Angular2 apps do not require any special configuration / plugins / services.
The steps are quite easy: Build your app, configure Webpack according to the guide found in the link above or here(Very nice description of how to build your application for production in an efficient way), and then start the production build via npm as described.
After that you could just drag your application to your ftp server and link the index.html. That's it!
Related
I need to deploy a Next.js app, but not on Vercel. What are the steps to deploying it?
I used to drag and drop the build folder from React to the server, but in Next.js I don't know which files I should deploy and how.
NB: I am using getServerSideProps so next export will not work.
A node environment where you can use next start is required. Therefore, you can use any platforms that offer servers, such as EC2, Digital Ocean, Linode, etc.
Because I need to deploy on a variety of servers and platforms, not all of which desire to have an additional node express server running, I have transitioned to Gatsby.js entirely. Same static page delivery as Next.js but no need for node or express on the server. Drag and drop the build folder into any server folder - just like React.
I suffer a lot in the past with angular apps and social media, so I'm glad to see that Angular Universal is being developed.
Currently I have some apps that are Angular4 as front end, and Java with Spring as backend. As far as I know there are some ways to implement Angular Universal here but they seem pretty complex (at least is what I read). So I want to know if that is in that way or not...
But anyway, my main question here, is because I saw that in order to implement Angular Universal we should have (ideally) to make the backend with nodejs, how to structure these two technologies, I mean... Should I have Angular app as a frontend app and Nodejs app as a totally different backend app (just like Java) where both are connected with web services? Or should I served Angular4 SPA direcly from Nodejs views?
And where should I place Angular Universal here?
Now that Angular CLI v1.6 is out, there's native support for building Angular Universal into your projects easily using Node.js! Essentially, you would ng build --prod to create a dist/ folder, and then create a simple node back-end and connect to your dist/ folder containing your front-end code. This article gives a great step-by-step guide: Angular server-side rendering in Node with Express Universal Engine.
When you use Angular Universal, it is going to be a single process (Operating system process) that hosts and serves your Angular pages.
In production you may have multiple such processes behind a load-balancer.
Your back-end APIs (if developed in Javascript) may be hosted in the same Node server or in separate server.
The Angular Universal setup steps are detailed here in the official documentation.
However, I had a few wasted hours to find out the following point
Webpack 3 is not compatible with ts-loader versions higher than 3.5.0. At the time of developing this, the latest version of Angular CLI is 1.7.2 which uses Webpack 3.*. Hence, while setting up Angular Universal, install ts-config#3.5.0
Finally, here I have a seed project for Angular Universal. It uses Vagrant to locally setup the development environment. Also, by tweaking an environment variable in your local host machine, you can run it in a production mode in a Docker container. The steps to run it are detailed in the readme file.
If you refer to my Dockerfile in the above Github link, its entrypoint reads:
ENTRYPOINT ["pm2-runtime","start","/home/aus/dist/server.js"]
So, you see, it's just a singe command, and your app is up and running at port 4000. Of course you can use other command line parameters to provide memory limit, port and so on.
So I'm new to Vuejs and doesn't know anything about npm, node, and other javascript apps.
I wanted to switch to VueJS so that I can take away from JQuery. Been using AdminLTE for my projects before.
I wanted to use vue-admin now since it seems to address all of my needs. However, I have specific work area situations that seems to hinder learning Vue and other JS apps, these are:
The workspace folder (development) where I'm creating applications is hosted in the production server (Windows Server).
I think NodeJS isn't installed in the server
Adobe Coldfusion is used. I don't have a local server, so the production server is used when developing.
Question:
Will the production server run the app built with vue-admin even if the production server doesn't have NodeJS installed? (I have NodeJS locally).
I need to use Coldfusion for the logic of the application, specifically I'm using CFWheels right now and vue-admin for Frontend and UX. Is it possible? The application I'm making is closely related to parts of an ERP system.
Any pointers on how I could do this?
Yes you can. Most likely you will need NodeJS locally to make your development life a bit easier.
You can simply include Vue in your project with a script tag or your can use a buildtool like Webpack to enable you to write ES6 and use a module system.
If you go with the latter it still exports as plain ES5 allowing you to use it on your server without any problem since all of this is code which runs on the clients machine, not on your server.
As you can see the requirements for this project have a big bold headline with: 'Development'.
https://github.com/vue-bulma/vue-admin#development
You don't need any of the requirements in production.
I'm currently having a look at JHipster.
What I could not figure out is how JHipster handles environments like dev, testing and production.
This includes:
server (configs like db or other app specific configurations)
client (Angular4, configs like api endpoint)
In angular-cli projects I'm used to environment specific configuration files (environment.dev.ts, environment.prod.ts) that can be defined at build (ng build --env prod) but since angular.cli does not seem to be the prefered way on JHipster there must be another solution to this.
So my questions is:
how to configure environments (server and client)?
how to specify the environment (server and client) during build?
If you are creating a standalone application or using the JHipster gateway bundle architecture, you can parameterize your Angular 2 app through webpack by using DefinePlugin. I detailed the steps to this process here: Environment-based properties for Angular 2 App Served by Webpack?
JHipster packages the client within the server as an executable jar so there is no need for different API endpoints between different environments on client side as long as you use /api.
On server side, JHipster uses Spring profiles which can be set dynamically and point to external configuration files (application*.yml files). By default JHipster comes with 2 main profiles dev and prod, but there are also others like swagger and no-liquibase that you can combine with dev or prod. You can define your own profiles too.
If your client app needs to access some external API endpoints (e.g. Google) that are different between environments, you can do it in 2 ways:
- retrieve the active profiles from server API using /api/profile-info and then initializes your endpoints in client code.
- create a new endpoint in server (e.g. /api/configuration) to fetch your client configuration
Then there are 2 kind of builds triggered by maven/gradle profiles: dev and prod.
For a newcomer, the most important thing is probably to understand Spring Profiles and application properties, these are not specific to JHipster.
I am building some React apps and am starting to think about the process of hosting. I am currently with Media Temple, which is a Apache based hosting, and I am on their (gs) grid server plan, which from what I can tell doesn't support installing Node.
I just wondered, do React apps need Node on the server?
If they do, what could my alternatives hosting options be?
Many thanks :)
If you're doing universal rendering, you'll probably need a Node server to support this.
But if it's only a static one-page application, you could perfectly not install Node on your hosting environment.
Using webpack for example, you can create a single js bundle of your vendors and sources files, a css one, and an index.html, Leaving you with 3 static files.
No, react apps doesn't require node server