Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robojones/var-server
https://github.com/robojones/var-server
Last synced: 23 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/robojones/var-server
- Owner: robojones
- License: mit
- Created: 2017-02-14T14:07:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-02-15T14:21:58.000Z (over 7 years ago)
- Last Synced: 2024-03-07T04:03:11.993Z (8 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# var-server
This module provides you with a simple server http server.
It can be used to write tests e.g. for worker processes in a cluster.## In the worker process
```javascript
require('var-server')(8080).listen()
```__Note:__ The server listens on `127.0.0.1`, so it is only accessible on the same computer.
## In the test file
```javascript
const s = require('var-server')(8080)s.run('process.argv').then(argv => {
console.log(argv) // the argv from the test process
})
```The code in the .get() method gets executed with `eval()` in the worker process.
```javascript
const s = require('var-server')(8080)s.run('process.cwd()').then(cwd => {
console.log(cwd)
})
```