Replies: 4 comments 4 replies
-
See SO How to run a hello.js file in Node.js on windows? This two changes to the best answer:
|
Beta Was this translation helpful? Give feedback.
-
Laragon is primarily a WAMP stack, Windows, Apache, MySQL and PHP. It can be used for Node, Python and many more local development environments. Suppose you want your front-end website to be my-project.test, create a folder in Laragon's www directory call my-project and restart Laragon. It will automatically create the host file with my-project.test and configure Apache (or Nginx). You can also add security and enable https access. See How to set up Laragon on a new Windows computer (part 4) - Enable security. The front-end website will need an index.html in the my-project folder or public/ folder for Laragon to identify as the entry point, otherwise, the directory structure will be displayed. Your Node backend will need to be running, I assume you are doing some API calls to it from the front end. The backend can be anywhere on your computer, I would recommend a folder under Laragon called api or node. Feel free to experiment with the app or code in the www directory to see if you can find what you are looking for. |
Beta Was this translation helpful? Give feedback.
-
@LebCit to serve node app. You will need to create a custom virtual host configuration file. Here's how you can do it:
define ROOT "C:/laragon/www/myapp"
define SITE "myapp.test"
<VirtualHost *:80>
ServerName ${SITE}
ServerAlias *.${SITE}
ProxyRequests Off
ProxyPreserveHost On
ProxyVia Full
<Proxy *>
Require all granted
</Proxy>
ProxyPass / http://127.0.0.1:3333/
ProxyPassReverse / http://127.0.0.1:3333/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerName ${SITE}
ServerAlias *.${SITE}
ProxyRequests Off
ProxyPreserveHost On
ProxyVia Full
<Proxy *>
Require all granted
</Proxy>
ProxyPass / http://127.0.0.1:3333/
ProxyPassReverse / http://127.0.0.1:3333/
SSLEngine on
SSLCertificateFile C:/laragon/etc/ssl/laragon.crt
SSLCertificateKeyFile C:/laragon/etc/ssl/laragon.key
</VirtualHost>
|
Beta Was this translation helpful? Give feedback.
-
I was creating a new post about this. But then I found this. So I guess I'll just share my result here. Here's a screenshot... |
Beta Was this translation helpful? Give feedback.
-
Hello,
Way back in time, I used Laragon to develop PHP apps.
Want to try it with Node.js but couldn't figure out how.
Made some research, but it was all about updating Node version in Laragon.
Sure that I'm missing some config because if I try a simple
Hello World
using express I'm getting the root folder.Any help is much appreciated.
Thanks a lot in advance for your time and guidance.
Beta Was this translation helpful? Give feedback.
All reactions