Skip to content

pm2 serve <path> -p 8000 #2670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Unitech opened this issue Jan 28, 2017 · 9 comments
Closed

pm2 serve <path> -p 8000 #2670

Unitech opened this issue Jan 28, 2017 · 9 comments

Comments

@Unitech
Copy link
Owner

Unitech commented Jan 28, 2017

Serve folder via http node.js server on desired port.
It needs to embed a simple standalone http server with full mime type support

@vmarchaud vmarchaud self-assigned this Jan 28, 2017
@Unitech
Copy link
Owner Author

Unitech commented Jan 28, 2017

@vmarchaud
Copy link
Contributor

vmarchaud commented Jan 29, 2017

CLI :
pm2 serve <path> <port>

Process file :

[{
  "name"      : "frontend",
  "script"    : "serve",
  "env": {
    "PM2_SERVE_PORT": 8081,
    "PM2_SERVE_PATH": "."
  }
}]

@soyuka
Copy link
Collaborator

soyuka commented Jan 29, 2017

I'm not found of the SERVE_PORT and SERVE_PATH variables, they're too generic. Maybe prefixed by PM2_?

Is there no library to handle mimes types? Having the list embed in the source code feels wrong no?

@vmarchaud
Copy link
Contributor

I looked into mime module that embed another dependency that contains a json list and if you look at the list there are a lot of uncommon mime so for me its better to have an hardcoded list of 90% mime used in normal environment than using module for this.
The env variable are indeed generic cause the Serve.js could be used outside of pm2 serve, its just a simple http server.

@soyuka
Copy link
Collaborator

soyuka commented Jan 29, 2017 via email

@vmarchaud
Copy link
Contributor

9ddee41

@soyuka
Copy link
Collaborator

soyuka commented Jan 29, 2017

👍

@Unitech
Copy link
Owner Author

Unitech commented Jan 30, 2017

That would be great to add some pmx probes to track:

  • 404/min
  • mean latency
  • hit count / min

@vmarchaud
Copy link
Contributor

Published PM2 2.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants