Hi, I’m going to start a new project with Ionic 3, but I also need a page web, where i’m going to show some graphics and other info coming from my data base, my question are if it’s possible and safe to post the project of Ionic 3 in any server?, What disadvantages would I have respect using Angular?
Ionic apps are Angular apps so it is not really different. Here you find a guide how to create a production build of your ionic app:
I used express to deploy my app. I took the www folder and made it accessible with express.static:
Woow, the information of the forum I clarify my doubt, thank you.
About express.js you have some tutorial that guides me to see how you use it, it’s something I’ve never used
Follow this guide
Then place this inside index.js:
const express = require('express'); const path = require('path'); const app = express(); app.use(express.static(path.join(__dirname, 'public'))); app.listen(3000, () => console.log('Server is listening on port 3000!'));
Now create a folder with the name public next to your index.js and put the content of your www folder inside, that was created by following this guide:
After that run
node index.js in your terminal to start the server. Now your ionic website should be available at http://localhost:3000/
Thats just an example. To deploy a production ready app that uses service workers and stuff like that you need for example ssl, a domain and stuff like that. Unfortunately I could not find any guide on how to deploy an ionic web app.
My pwa is running in a similar way. But my express app is running in a docker container communicating with another docker container that contains a mongodb. I added ssl, a domain, cors, passport authentification, jwt, a rest api and much more. I hosted it with docker-machine on a digital ocean droplet. Most of it I had to find out by myself. Maybe there are easier ways of doing it, but I never tried.