Ishan Patel
Ishan Patel

Reputation: 6091

Is it possible to extend api built in Ruby on Rails with NodeJs?

I am learning Node.Js and I already have some API built in Ruby.

Is there a way to add extra endpoints to that API using Node.Js?

Thanks

Upvotes: 0

Views: 58

Answers (1)

jemiloii
jemiloii

Reputation: 25719

You have a few options: Have your node app be a reverse proxy and listen to all calls, whatever routes it does not handle, forward it to the rails App.

Forward express js route to other server

Have your Rails app be a reverse proxy and forward the new routes to the node app.

How can I use Rails routes to redirect from one domain to another?

Using a a reverse proxy like ngnix or traefik. These would listen to all routes and send the request to the app you have configured. Traefik makes it really easy if you're already using docker. Traefik also has a binary file for windows/mac/linux that's also pretty easy to setup using the [File] config

https://docs.traefik.io/

Upvotes: 2

Related Questions