I'm exploring the possibility of integrating a portion of my existing Express.js project with Gin (Go). I'd like to gather community insights on the feasibility of this approach and potential compatibility issues. Please share any ideas, experiences, or code samples that demonstrate how to achieve this or highlight potential pitfalls. I've included sample code snippets below to illustrate my current setup.
JavaScript
// Express.js (Node.js) Example const express = require('express'); const app = express(); app.get('/api/node', (req, res) => { res.send('Response from Node.js'); }); app.listen(3000, () => console.log('Node.js server running'));
Go
// Gin (Go) Example package main import "github.com/gin-gonic/gin" func main() { r := gin.Default() r.GET("/api/go", func(c *gin.Context) { c.JSON(200, gin.H{ "message": "Response from Go", }) }) r.Run(":8080") }
Comment From: Yatin-aggarwal
Yes, it’s feasible to integrate both Express.js and Gin by splitting your project into separate microservices. Each service can be built using the language and framework best suited to its specific functionality — for example, using Node.js for API gateways or frontend-facing logic, and Go (Gin) for performance-critical backend services. These services can communicate via HTTP or gRPC.