using bolt cms for single page app - bolt-cms

I want to use bolt as a headless cms. My plan is to create a template based on vue.js and load the content utilizing the bolt plugin jsonAPI.
But I'm struggling with the theme and config settings.
I want to disable all routing in the CMS and return only a static html with css and js files.

I think your problem could be solved by the following alternative solution :
Use different domain
Put your vue SPA app in yourdomain.com and put your bolt as RESTAPI provider in subdomain.yourdomain.com. Since it's a subdomain, you would not face any CORST problem, and you can follow common tutorial how to setup bolt cms and how to build vuejs SPA.
Use vuejs SPA in bolt cms template
Assume you develop vuejs SPA using webpack, you have to setup asset public path as bolt template location, the configuration file is in your-vue-directory/config/index.js
module.exports = {
build: {
assetsPublicPath: '/theme/your-theme/',
......
},
}
Then after finish build the app, you can copy your build files from your-vue-directory/dist into your-bolt-directory/public/theme/your-theme
But using this solution, if you're using vue-router, i think you cannot use 'history'mode since all of the routing will be handled by bolt cms. The only possible router-mode is 'hash'.

Easiest would be to have them all use the same template, and have that template say <html></html>, and you're done.

Related

Why does a React build need to be served? Why can't I just open it in the browser?

Apologies for somewhat of a basic question, but I haven't been able to find the technical reason anywhere I've looked.
Basically, if I do npm run build I get a static html file and a bunch of css and javascript files in the build folder. I would think that I should then be able to open up that index.html file in the browser and have it work, just as would be the case for some static HTML built without React.
So, my question is: what is it that react is relying on that requires to be served up with a static file server like serve or webpack dev server?
It uses Ajax internally. The Same Origin Policy prevents it reading file: scheme URLs in most browsers.

Need to serve both GSPs and JSON from a Grails 3.1.5 app

I wanted my Grails 3.1.5 app to serve both JSON data using the *.gson format AND, for some pages/URLs I wanted to continue to use GSPs.
I built an app using the rest-api profile.
Then I copied over controllers and views from an other app that I'd built using the web-api.
In doing so, and to be consistent, I also moved index.gson to a different location.
Now I get a:
Could not resolve view with name 'index' in servlet with name 'grailsDispatcherServlet'
Started digging into the viewResolvers that are available in the 3.1.5 code base. It is possible that the rest-api profile configures a viewResolver to look for *.gson files in a certain location.
Is there anyway to configure maybe a CompositeViewResolver that looks for both the views, *.gson and *.gsps?
If so, how can I do this?
Thanks!
I've managed to resolve this issue by adding this plugin to build.gradle:
compile 'org.grails:grails-plugin-gsp'
and with both
profile 'org.grails.profiles:web'
profile 'org.grails.profiles:rest-api'
and apply plugins
apply plugin: 'org.grails.grails-web'
apply plugin: 'org.grails.grails-gsp'
apply plugin: 'org.grails.plugins.views-json'
Apparently, they remove it when you're using REST profile, to reduce overhead, as you rarely render HTML on REST service side.

Ruby on Rails .html.erb file not created

I recently began working with Ruby on Rails.
I'm familiar with the MVC concept and using RubyMine as editor. But I'm probably missing something, because when I generated controller via Run Rails Generator, I added Destination Folder to the controller (because I wanted to create special folder for the UI pages, that won't be in the DB and are only used for the front-end). The problem is, that there is no .html.erb file created in the assets/views, just the folder from the Destination folder.
Good to mention, that database entities are created via scaffolding and are already in the folders: controllers and views.
Also, I will use this opportunity, to ask for good tips for generating that HTML and CSS front-end pages directly in Rails, because I've mostly worked on back-end in this technology.
Thank you in advance.
First of all, if you are beginning with Rails I would recommend not to go against the conventions that the framework already puts up for you.
Secondly, if you want the pages which just have no DB connectivity and just for static UI, you can do something like this:
$ rails generate controller Pages home contact somepage
which will create a pages folder inside /app/views/ of your project with .erb templates for the home, contact, somepage
More info: http://guides.rubyonrails.org/layouts_and_rendering.html
Hope it helps!

How to handle multiple envoirnment urls in Polymer

I am developing a polymer component which is using firebase polymer element inside it.
I have seperate URls for firebase in staging and production, so I want to know what is the best design pattern to handle these environment urls in the polymer app.
If it's one instance, can you just change the location to your staging URL?
For something more advanced (e.g. using a mock endpoint with all instances of <firebase-element> or testing), Scott put together an example of how to use core-ajax with mock data that may be useful: https://github.com/PolymerLabs/mock-ajax.

Display remote content - Joomla

I have a spring MVC app and a joomla "showcase web site".
How can I display data from spring MVC in my joomla showcase site?
My first attempt was to create a simple joomla module with inside jqgrid. But I discovered that many browser deny JSON cross domain and that this attempt is not good.
I also tried with an IFrame.. but I don't like this approach..
The current attempt is to export data from MVC app in RSS. I've installed an rss module in joomla and it works. But it's limited in search and sorting operation.
It would be great to find a way that permit to filter and sort data using some existent and open joomla module.
Does anyone have suggestion on proper export data tecnology and a related module?
#mserioli
You should use the php curl, and in your module you make the request using the GET or POST method to retrieve data (json/xml) from your MVC app