Ways to separate backend and frontend? - ajax

I want to create project with completely separated back-end (Laravel/Lumen) and front-end (Vue.js). What is most common and best practice to achieve this?
1. domain.com + domain.com/api
2. domain.com + domain.com:port
3. domain.com + api.domain.com
4. other?
Any of these has any pros and cons?

Related

Laravel + Angular 4

I want to create some project and use there Laravel as API and Angular 4 to represent my site.
Since I have no money for experiments, I found hostinger.co.uk where I can set up php framework and do that I need.
I started configuring Laravel and get confused - where to place my site on angular? I'll have the only one site address. So I'd like to make it combined, because I need Laravel the only for working with DB.
Best practice would be to keep api & frontend seperate.
If you insist on using single domain, such as example.com you can use subdomain api.example.com for API, and main domain for presenting your site.
On a shared hosting you can place folders something like these:
/api -- laravel installation(with subdomain api.example.com)
<angular build files>
index.php
script.bundle.js
style.bundle.js
etc.
......
.....
.....
.....
For development you can keep your angular files anywhere on your local system, and upload only build distribution to the main domain.

How can i use multiple url eg. www.example.com,www.example1.com,www.example2.com, to point same project directory?

I want to use different view along with data for different URL . For example use view1, view1, view2 for www.example.com, www.example1.com and www.site2.example.com respectively.I have managed this making server alias in wamp. How can i do this in real hosting. e.g my registered domain is www.example.com
When you create URLs like "Site1.example.com" or "site2.example.com", you are effectively creating sub-domains on the server. Each sub-domain require separate deployment/installation (unless, you have enabled wildcard setting in sub-domain where all the domains are pointing to single sub-domain/address).

Hide real URL with ISAPI Rewrite?

Is it possible to hide real URL with HeliconTech's ISAPI Rewrite module? To be more specific, consider the following scenario:
User requests an URL "example.com/something".
"In the background", server redirects the request to another URL "anotherexample.com".
Contents from "anotherexample.com" are returned to the user (user still sees "example.com/something" in his/her browser address bar after response has been received).
So, the user must not be aware of the fact that contents came from different URL. If this isn't possible with ISAPI Rewrite, do there exist another ways to implement the functionality (in IIS 6 + SharePoint 2007 environment)?
This is achieved using proxy functionality in ISAPI_Rewrite 3. Here are the rules to put in .htaccess in the root of example.com site:
RewriteBase /
RewriteRule ^(.*)$ http://www.anotherexample.com/$1 [P]

Ember.js, Rails and Wildcard Subdomains

How can I use ember.js routing with rails wildcard subdomains?
Say, a user signs up on the site, they get a subdomain. Joe and Josh both sign up, they each get a subdomain.
joe.mysite.com
josh.mysite.com
Rails routes all my api calls (routes.rb) while ember routes everything else. What would the best way of doing this? Using rails or ember to route it? Is it even possible to use ember to route subdomains?
The best way would be programmatically checking with location.host or location.hostname.
But ember usually works it's magic by faking URLs and not reloading the page... I don't know of any way to switch subdomains without reloading the page.
I'd redirect the subdomain to a URL in your main app and let Ember handle the routing from there.

Making codeigniter admin to rule them all

I want to make a codeigniter admin/cms to manage all my clients front ends, i want to separate the admin application in two folder, the generic folder, that all other will extend or use, and the client site admin, that i will make for the client needs.
Can it be done?
i recommend the WireDesigns HMVC - https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc
This will allow you to make 2 modules Front-End / Admin in each module it follows hte same rules of Controller / Model / View which you can build up each one independently but to work together.
Technically though you could just create 2 folders in your controllers folder called Frontend / Admin, and build your controllers right there.
but if you looking for cleaner ogranization, try the HMVC

Resources