Angular is a web framework by Google which allows you to create progressive web apps (PWAs) which are single page applications (SPA).
It can also be used to create native mobile or desktop apps.
Note that this is a front-end framework only. You will need to pair it with a back-end framework to get stateful functionality.
This page is about Angular, also known as Angular 2. For AngularJS, the predecessor to Angular, see https://angularjs.org/.
Place the following in the apache config for your site or in an .htaccess file:
Rewrite Rules
RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
# If the requested resource doesn't exist, use index.html
RewriteRule ^ /index.html
Express
How to setup an Express server to host your Angular web application:
if(CONFIG.app.useProxy){constmyProxy=httpProxy.createProxyServer({ws:true});console.log(`Proxying to ${CONFIG.app.appProxy}`);router.all('/*',(req:Request,res:Response,next:NextFunction)=>{myProxy.web(req,res,{target:req.protocol+'://'+CONFIG.app.appProxy});});}else{router.all('/*',express.static(CONFIG.app.appFolder));router.all('/*',(req:Request,res:Response,next:NextFunction)=>{res.status(200).sendFile('index.html',{root:CONFIG.app.appFolder});});}
If you are proxying for development, you will also need to proxy websockets: