G
G
gooseNjuice()2021-02-24 21:52:15
PHP
gooseNjuice(), 2021-02-24 21:52:15

How to display a php file in response to a get request in NodeJS?

There is a project in which the client part is written in PHP. I am writing a server using ExpressJS, and I need to somehow send, for example, about.php in response to a request to the route. The problem is that I only know different view engines like pug/jade. Can you suggest which direction to go?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Vasilyev, 2021-02-24
@hello_my_name_is_dany

If you really need to render PHP specifically, you can start the process php about.phpand intercept the standard output. You will not have access to the request information, but you can pass the information you need through arguments php about.php firstname lastname
PS Still, you don’t need to do this, you create a lot of problems for yourself, and you don’t need PHP here. Finally, you can use EJS if you need some super-duper logic in your template.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question