Browse Source

Updated README.md

pull/1/head
Muthu Kumar 7 years ago
parent
commit
5d93df1d0c
  1. 33
      README.md
  2. 8
      actions/createStaticServer.js
  3. BIN
      assets/up.gvdesign
  4. BIN
      assets/up.png
  5. 3
      assets/up.svg
  6. 9
      index.js

33
README.md

@ -1,14 +1,35 @@
# `up` — quick server blocks
<p align="center"><a href="http://moonjs.ga" target="_blank"><img width="100"src="assets/up.png"></a></p>
> ⚠️
🚫
`up` is not ready for use yet! It's in pre-release.
---
**`up`** is a command line application to create nginx server blocks quickly in a single command.
<h2 align="center">`up` — quick server blocks</h1>
---
> ⚠️ ❌ `up` is not ready for use yet! Do not attempt to use this.
**`up`** is a command line application to create nginx server blocks quickly with a single command.
You will need to have nodeJS and nginx installed.
https://nodejs.org
You will need to have nginx installed.
https://nginx.org
---
### Commands
`up static <domain>` - Create new static server at current folder.
`up proxy <domain> <port>` - Create new proxy server listening at said port.
`up list` - List currently available servers.
`up kill <domain>` - Kill the server for this domain.
---
### Examples:
`up static example.com` will serve a static website from current folder.

8
actions/createStaticServer.js

@ -1,10 +1,10 @@
var fs = require('fs-extra')
function createStaticServer(domain, port) {
function createStaticServer(domain, outPort = 80) {
fs.outputFileSync("/test.txt",
"server {" + "\n" +
" listen 80;" + "\n" +
" listen [::]:80;" + "\n" +
" listen " + outPort + ";" + "\n" +
" listen [::]:" + outPort + ";" + "\n" +
" root /var/www/" + domain + ";" + "\n" +
" index index.html index.htm;" + "\n" +
"" + "\n" +
@ -15,4 +15,4 @@ function createStaticServer(domain, port) {
)
}
module.exports = createProxyServer
module.exports = createStaticServer

BIN
assets/up.gvdesign

Binary file not shown.

BIN
assets/up.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

3
assets/up.svg

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Gravit.io -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="395.02 156.363 1172.98 603.637" width="1172.98" height="603.637"><rect x="395.02" y="156.363" width="1172.98" height="603.637" transform="matrix(1,0,0,1,0,0)" fill="rgb(244,244,244)"/><linearGradient id="_lgradient_0" x1="0%" y1="50%" x2="100%" y2="50%"><stop offset="0%" stop-opacity="1" style="stop-color:rgb(69,69,255)"/><stop offset="97.82608695652173%" stop-opacity="1" style="stop-color:rgb(209,92,255)"/></linearGradient><path d=" M 778.066 267.648 L 877.865 440.505 L 977.664 613.361 C 986.63 628.892 979.351 641.501 961.417 641.501 L 761.82 641.501 L 562.222 641.501 C 544.289 641.501 537.009 628.892 545.976 613.361 L 645.775 440.505 L 745.574 267.648 C 754.54 252.117 769.1 252.117 778.066 267.648 Z " fill="url(#_lgradient_0)"/><linearGradient id="_lgradient_1" x1="0%" y1="50%" x2="100%" y2="50%"><stop offset="0%" stop-opacity="1" style="stop-color:rgb(105,102,251)"/><stop offset="100%" stop-opacity="1" style="stop-color:rgb(103,149,255)"/></linearGradient><path d=" M 1193.557 518.34 L 1191.945 496.514 L 1191.945 496.514 Q 1184.035 508.232 1172.17 514.751 L 1172.17 514.751 L 1172.17 514.751 Q 1160.305 521.269 1144.777 521.269 L 1144.777 521.269 L 1144.777 521.269 Q 1132.326 521.269 1122.219 517.388 L 1122.219 517.388 L 1122.219 517.388 Q 1112.111 513.506 1104.933 505.303 L 1104.933 505.303 L 1104.933 505.303 Q 1097.756 497.1 1093.874 484.429 L 1093.874 484.429 L 1093.874 484.429 Q 1089.992 471.758 1089.992 454.033 L 1089.992 454.033 L 1089.992 359.844 L 1117.092 359.844 L 1117.092 454.326 L 1117.092 454.326 Q 1117.092 467.217 1119.142 475.713 L 1119.142 475.713 L 1119.142 475.713 Q 1121.193 484.209 1125.295 489.263 L 1125.295 489.263 L 1125.295 489.263 Q 1129.396 494.316 1135.329 496.367 L 1135.329 496.367 L 1135.329 496.367 Q 1141.262 498.418 1149.025 498.418 L 1149.025 498.418 L 1149.025 498.418 Q 1165.578 498.418 1175.759 491.68 L 1175.759 491.68 L 1175.759 491.68 Q 1185.939 484.941 1190.92 473.516 L 1190.92 473.516 L 1190.92 359.844 L 1218.166 359.844 L 1218.166 518.34 L 1193.557 518.34 Z M 1402.883 437.773 L 1402.883 440.85 L 1402.883 440.85 Q 1402.883 457.842 1398.781 472.563 L 1398.781 472.563 L 1398.781 472.563 Q 1394.68 487.285 1386.769 498.125 L 1386.769 498.125 L 1386.769 498.125 Q 1378.859 508.965 1367.214 515.117 L 1367.214 515.117 L 1367.214 515.117 Q 1355.568 521.269 1340.627 521.269 L 1340.627 521.269 L 1340.627 521.269 Q 1326.125 521.269 1315.065 516.582 L 1315.065 516.582 L 1315.065 516.582 Q 1304.006 511.894 1296.096 503.105 L 1296.096 503.105 L 1296.096 579.277 L 1268.996 579.277 L 1268.996 359.844 L 1293.752 359.844 L 1295.07 377.129 L 1295.07 377.129 Q 1302.98 367.314 1314.186 362.114 L 1314.186 362.114 L 1314.186 362.114 Q 1325.392 356.914 1340.187 356.914 L 1340.187 356.914 L 1340.187 356.914 Q 1355.422 356.914 1367.141 362.92 L 1367.141 362.92 L 1367.141 362.92 Q 1378.859 368.926 1386.769 379.619 L 1386.769 379.619 L 1386.769 379.619 Q 1394.68 390.312 1398.781 405.181 L 1398.781 405.181 L 1398.781 405.181 Q 1402.883 420.049 1402.883 437.773 L 1402.883 437.773 Z M 1375.783 440.85 L 1375.783 437.773 L 1375.783 437.773 Q 1375.783 426.201 1373.22 415.727 L 1373.22 415.727 L 1373.22 415.727 Q 1370.656 405.254 1365.309 397.27 L 1365.309 397.27 L 1365.309 397.27 Q 1359.963 389.287 1351.76 384.6 L 1351.76 384.6 L 1351.76 384.6 Q 1343.557 379.912 1332.131 379.912 L 1332.131 379.912 L 1332.131 379.912 Q 1319.094 379.912 1310.231 385.991 L 1310.231 385.991 L 1310.231 385.991 Q 1301.369 392.07 1296.096 401.592 L 1296.096 401.592 L 1296.096 477.91 L 1296.096 477.91 Q 1301.369 487.285 1310.158 493.218 L 1310.158 493.218 L 1310.158 493.218 Q 1318.947 499.15 1332.424 499.15 L 1332.424 499.15 L 1332.424 499.15 Q 1343.703 499.15 1351.906 494.39 L 1351.906 494.39 L 1351.906 494.39 Q 1360.109 489.629 1365.383 481.572 L 1365.383 481.572 L 1365.383 481.572 Q 1370.656 473.516 1373.22 462.969 L 1373.22 462.969 L 1373.22 462.969 Q 1375.783 452.422 1375.783 440.85 L 1375.783 440.85 Z " fill-rule="evenodd" fill="url(#_lgradient_1)"/></svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

9
index.js

@ -35,11 +35,12 @@ program
.version('0.0.1')
program
.command('static <domain> [relativePath] [outPort]')
.command('static <domain> [outPort]')
.description('Create a static server at this folder.')
.action(function(domain, relativePath="", outPort="") {
.action(function(domain, outPort="") {
if(!isDomain(domain)) console.log('\nDomain is not valid. Please use a valid domain name.')
// Stuff happens here
createStaticServer(domain, outPort)
})
program
@ -59,7 +60,7 @@ program
console.log('\nPort should be a number.')
return; }
else {
createProxyServer(domain, inPort)
createProxyServer(domain, inPort, outPort)
console.log('Done!')
}
})
@ -88,7 +89,7 @@ program.on('--help', function(){
console.log('');
console.log(' Usage:');
console.log('');
console.log(' ', chalk.yellow('$ up'), chalk.cyan('static'), chalk.blue('domain-name'), chalk.grey('relative-path(optional)'));
console.log(' ', chalk.yellow('$ up'), chalk.cyan('static'), chalk.blue('domain-name'));
console.log(' Set up a static server at domain-name');
console.log('');
console.log(' ', chalk.yellow('$ up'), chalk.cyan('proxy'), chalk.blue('domain-name port-number'));

Loading…
Cancel
Save