Laravel Sanctum Session (Backend & Frontend Separated) - laravel

I'm developing a project has two separate projects
Backend : Laravel API
Frontend: VueJS SPA
I want to let the front-end developer develop the front-end project without installing the backend locally.
Can I upload the backend in the Remote server? and frontend locally?
I use a "Session Driver". it has a domain restriction.
frontend: localhost:XXXX
backend: api.example.com

Related

Working on backend with Nuxt frontend url paths

I have a project, using Nuxt 2 as frontend and Php-Laravel as backend app. The app have multiple language on each side also using localized routes in Nuxt + i18n.
We're sending some notification emails on backend managed by cron jobs, some emails contains a links to directed to front end.
But there is too many options due to localized routes and it is hard to manage.
For example, there is a page on frontend
en/account/payments/12345/invoice
tr/hesap/ödemeler/12345/fatura
es/cuenta/pagos/12345/factura
fr/compte/paiements/12345/facture
it/account/pagamenti/12345/fattura
How can i manage that?
I've tried a create server middleware on Nuxt to create these routes and to work act rest api server only return paths as json, but i can't access vue-router on server middleware.
Could you suggest me a solution?

Nuxt & axios configuration with a tenant subdomain designed API

Does anyone knows how I am supposed to manage Nuxt & axios configuration with a multi-tenant API built with django-rest-framework and django-tenants (https://github.com/django-tenants/django-tenants)?
This API is reachable by tenant subdomain: tenant1.example.com/api, tenant2.example.com/api, ... (within my dev environment: tenant1.localhost:8000/api, tenant2.localhost:8000/api, ...)
In my Nuxt app, I want to use #nuxtjs/axios and #nuxtjs/auth-next.
→ How can I proxy axios API URL to take into account the API subdomains (tenant1.example.com/api, ...)?
→ How can I configure auth endpoints (tenant1.example.com/api/login, ...)?
Thanks for your help!

connect nuxtJS with laravel

I'm new in LARAVEL and nuxtJS, So sorry for my question if it somehow silly. I'm working on a project that developed by anthor one. There is no implementation. The client gave me two folder one for frontend developed by nuxtJS and one for backend developed by laravel.
I tried to run a project. But I fails. Could anyone to help me in that. I installed npm for nuxtJS and composer for laravel.
please ask me for anypart of a code which can help. And I'll post it
Thak you.
Assuming Laravel is intended as an API, treat each folder as a separate app. Startup your nuxt application like any other nuxt application. Startup your Laravel application like any other Laravel application. Then using axios or some other fetch library inside your nuxt app, make requests to your Laravel url.
Say you have nuxt running on http://localhost:3000 and you have Laravel running on https://localhost:8000. Inside your nuxt app, where you need to connect to Larvel, you can use axios to get access to your data from Laravel (e.g. axios.get('http://localhost:8000/api/some/resource'))
The docs on asyncData has a good example of making API calls https://nuxtjs.org/guide/async-data

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