Browse Source

First module exported

pull/1/head
Muthu Kumar 7 years ago
parent
commit
99136954bb
  1. 8
      actions/createProxyServer.js
  2. 3
      index.js

8
actions/createProxyServer.js

@ -1,8 +1,6 @@
var fs = require('fs-extra') var fs = require('fs-extra')
var domain = domain function createProxyServer(domain, port) {
var port = port
fs.outputFileSync("/test.txt", fs.outputFileSync("/test.txt",
"server {" + "\n" + "server {" + "\n" +
" listen 80;" + "\n" + " listen 80;" + "\n" +
@ -20,4 +18,6 @@ fs.outputFileSync("/test.txt",
" proxy_cache_bypass $http_upgrade;" + "\n" + " proxy_cache_bypass $http_upgrade;" + "\n" +
"}" "}"
) )
console.log('Done') }
module.exports = createProxyServer

3
index.js

@ -41,12 +41,13 @@ program
.action(function(domain, port) { .action(function(domain, port) {
if(!isFQDN(domain)) if(!isFQDN(domain))
console.log('\nDomain is not valid. Please use a valid domain name.') console.log('\nDomain is not valid. Please use a valid domain name.')
else if(typeof port != 'number') else if(typeof port !== 'number')
console.log('\nPort should be a number.') console.log('\nPort should be a number.')
// Stuff happens here // Stuff happens here
//test stuff will be deleted later: //test stuff will be deleted later:
else else
createProxyServer(domain, port) createProxyServer(domain, port)
console.log('Done!')
//test stuff ends here //test stuff ends here
}) })

Loading…
Cancel
Save