How to config Laravel API and NuxtJS in same domain - laravel

I have a domain like domain.com
I have a Web API (Laravel) at domain.com/api
I have landing page (Laravel) at domain.com/
I have blog (Laravel) at domain.com/blog
I have Web App (NuxtJS) at app.domain.com
I want to merge domain.com and app.domain.com into one. What do I have to do to achieve that?
My server uses Nginx and Centos 7. Thank you so much for reading my question!

Related

How can I have my nextjs app and my strapi CMS have the same domain and subdomain?

I have 2 apps on my heroku, one for my nextjs page and another for my strapi headless CMS. Right now I have a subdomain for strapi, and the root domain for nextjs.
I use heroku, my current situation is subdomain.example.com/admin for strapi and example.com for nextjs.
What I wanted was example.com for nextjs and example.com/admin for strapi.
Thanks

How to have one domain serving frontend and backend?

Let's say I purchase the domain: "www.myapp.com".
I'm planning to run a headless CMS on heroku and a Vue js frontend on netlify.
How can I use the same domain for both apps?
I would like something like this:
Backend: "backoffice.myapp.com"
Frontend: "www.myapp.com"
Is it possible with 1 domain? How do I approach this?
In your domain provider panel you create backoffice.myapp.com subdomain and point CNAME record to heroku. And you set a CNAME record for www.myapp.com to netifly.
Instructions:
Netifly
Heroku

How do I make structure SPA and SSR with Laravel?

I'am using Laravel + Nuxt for current project.
Web app has user pages and admin pages.
user pages are working in Laravel + Nuxt SPA but admin pages should works on pure Laravel SSR.
I dont know how to make project structure.
Thank you in advance.
I found answer in this package
https://github.com/m2sd/nuxt-laravel
Main point is route web.php
It redirects SPA requests to Nuxt router
Admin dashboard router should be extracted into new file(ex. admin.php)
Correct answer is following to above article.

Connect backend and frontend

How to connect frontend to backend?
The site was Laravel 5.7 + VUE. Now was completely written from scratch in JS frontend (self-written).
I. e. it is necessary to leave the old backend (Laravel 5.7) + API and connect the new frontend to it.
As I understand it, you need to rewrite the old backend for a new frontend or not?
New frontend only. The task is to connect the old backend and API to the new frontend.
It's not necessary to rewrite your backend, in fact a would try to leave it as it is, and just try to connect new frontend with existing backend API (endpoints). Or is there any specific reason for changing the backenend codebase?
VUE is a Javascript frontend framework and Laravel is a framework for PHP so you do not need to rewrite the backend. What you need to do is configure your frontend to match the
Laravel codebase in the backend.

Using Laravel and Ionic together with Nginx routes

I have an Ionic 3 web app where I'm using Laravel for both the API and the back-end manager with Nova. Ideally, I'd like my setup to be:
Server 1: example.com serving only my static Ionic App
Server 2: api.example.com serving my Laravel API
Server 2: example.com/admin serving my Laravel backend with Nova
This is easy with Laravel forge, except that I want api.example.com and example.com/admin to be powered by the same application. Right now it looks like I would need my code to live as two separate applications, one for api. and one for /admin.
It makes sense that there would be a way to configure Nginx to point both to the same place, but how, and which one, and where?
I solved this with a redirect from /admin to the appropriate destination. You can either do this in nginx or in Ionic.

Resources