integrating existing SPA app with meteor.js as backend - meteor

I have an existing SPA app . This SPA was developed with Aurelia . The app is loaded from index.html file.
I need to host the app into meteor saving these options :
1. Meteor shouldn't build the SPA app (ignore building it each time it changed).
2. How I can request the index.html file from meteor in order to load the app .
Thanks in advance ...

As for preventing Meteor from touching your index.html file, you could simply place it in the public special folder.
To serve this file, you could for example have an iframe which points to your file (do not include public/ in your path, e.g. if your file is in public/spa/index.html, use src="spa/index.html")

Related

React/WordPress PWA does not respond with a 200 when offline

I am currently trying to build a WordPress theme using React/Redux. Everything is working as expected except for responding with 200 when offline.
The build folder of CRA (Create React App) is located at /wp-content/themes/pwa/build.
When online, WordPress loads the index.php for all routes. This registers the .css and .js from the build folder. Here everything is working as expected.
Im trying to understand how to configure CRA / WorkBox to register the service worker at / and serve all pages using the index.html in the build folder whilst offline.
Full url of index.html: https://example.com/wp-content/themes/pwa/build/index.html
I can provide a link to the demo if required.
I finally solved the problem with some help from W3C.
Pass scope option in /src/serviceWorker.js of the react app.
// navigator.serviceWorker.register(swUrl)
navigator.serviceWorker.register(swUrl, {scope: "/"})
Configure Apache to serve the Service-Worker-Allowed header for the deployed service worker.
<Files "service-worker.js">
Header Set Service-Worker-Allowed "/"
</Files>

Hashlocation strategy in angular on top of ASP.net application

I'm currently building a feature angular application on top of an asp.net application. I want the angular module to load on all pages but not interfering with the routing of the asp.net application.
I achieve this by using hashlocation strategy but the problem is that some modules are not found when navigating in the application. The bundels are placed in a folder called "plugins"
For instance
localhost:/foo1 - WORKS
localhost:/foo1/foo2 - One module not found (looks in foo2/plugins folder)
localhost:/foo1/foo2/foo3 - Custom themes not found and module not found (looks in foo2/foo3/plugins)
Is there a way to set the deploy url in angular cli to a relative base folder as to look for files in /plugins disregarding the current url?
Is Static files are allowed in your .net app ?
For example in .net core, be default static files allowed and all files from wwwroot folder you can use in ur application.

Serving a web app from a nested folder in ASP.NET as if it was root

I am working with an Angular 2 app that is being served with a simple ASP.NET WebApplication.
The whole code is bundled into 1 folder with webpack. Currently when I want to (re)deploy the ng app I have to delete old bundle and index.html files and paste in new ones, then include them in VS project and publish.
How would I go about serving all those files from a dist/ folder in my asp.net app without changing the autogenetared files?
I tried putting the folder, that includes index.html, there, and adding path to that index file in web.config, but then I also need to update the autogenerated paths to bundles on index.html, because by default it still looks at the root dir.
you may set base tag in your html.
<head>
<base href="/dist/" >
</head>
so all the URL will be relative to that.
And you may access your application by navigating to
<root url>/dist/index.html
Hope this helps!!

Meteor public folder not working

I'm new to Meteor and I'm trying to understand how to serve static content - images, JS, etc.. I've followed the docs by creating the correct folder structure (which it doesn't really touch on) but making requests to this content just fails over to serving the main app page instead.
For instance - putting an image in "app_root"/public/image.png and making a request to localhost:3000/image.png just returns the main app page.
Any clue what I'm doing wrong here?
Thanks!
The setup you have described sounds correct to me. Media in public/ are served like
http://localhost:3000/myphoto.jpg
The todos example serves images from the public directory. Just back out of whatever project you're in and run: meteor create --example todos then cd into todos/ and run meteor. Then open:
http://localhost:3000/destroy.png
The image you will see lives in public/.
Meteor public folder not working
Use ./public directory for serving static assets.
Given the following directory structure:
- server
- client
- public
- css
- bootstrap.css
- images
- js
You could serve the static assets by dropping 'public' from linked documents.
<link href='/css/bootstrap.css'>
More info here: Official Meteor Docs #FileStructure
Files in /public are served to the client as-is. Use this to store
assets such as images. For example, if you have an image located at
/public/background.png, you can include it in your HTML with or in your CSS with background-image:
url(/background.png). Note that /public is not part of the image URL.
That same thing happened when I moved the project files in a folder and forget to move the directory .meteor.

symfony routing.yml config for site folders

I have symfony web files in web root folder where the project is running. I have site files such as index.html, aboutus.html and contactus.html files. I have put these files into public_html/site/ How to access these files by default using routing.yml? also project should run in index.php
Hm...If you want to add to your project some static pages, I would recommend you this method.I think this is the right way. For index.php ,well read this
Why don't you make a new module for static pages and move the html content into it?
You have to understand that routing system in symfony is used for connect requested urls to controllers. So you can't use it to provide generating urls for static pages outside of your symfony application. That files are just like files of foreign site.
So you can just use link_to('about us', $this->getRequest()->getHost().'/about_us.html');

Resources