I have a live web app made in laravel. Is there a way for me to migrate the entire thing on express ? Or Can I have an environment where I use both laravel and express each specialising in the things that they do best?
What do you mean by "live web app"? Does "live" mean in production or something like a single page application? Either way there are some solutions.
There isn't a migration tool to convert code between Laravel and Express that I know of. I doubt that one exists. You can, however, run both systems in tandem; you might call this something like a microservices architecture.
I will commonly split out my web system into an API server and a more conventional web server, something that renders HTML like Angular's server-side rendering engine. I containerize each of these services using Docker and orchestrate the services using Docker Compose. I also add a container for Nginx, which is a reverse-proxy server. Nginx allows me to define separate URL routes that will route requests to different servers internally. I'll define a /api route that proxies to the API server and a / route that proxies to the web server. Both servers are hidden behind the same port, port 80, which is the port that Nginx listens.
With this approach you could incrementally migrate between Laravel and Express by mapping particular routes to Laravel and other routes to Express . Obviously you will end up having some redundancies here because Laravel and Express will not be able to share modules like authentication.
Using containers will also help with running blue-green deployments, which will permit you to transition safely between deployments with near-zero downtime. A primitive way to do blue-green deployments with a non-containerized system is to set up a second host machine and use DNS to transition seamlessly from old to new.
Ryosuke
Designer / Developer / Influencer
Try using AdonisJS. It's a Node based framework written to work like Laravel.
// Defining routes Route.get('posts/:id', async ({ params }) => { const post = await Post.find(params.id) return post }) // Working with Requests const drink = request.input('drink') // with default value const drink = request.input('drink', 'coffee')As you can see, they have a lot of facades that mimic Laravel's API. You won't be able to just copy paste and run, but it'll definitely make migration much easier without your mind doing mental jutsu translating between Laravel's Routing API and Express'.