Browse Source

[wip]

master
Muthu Kumar 6 years ago
parent
commit
b67a3190af
  1. 4
      README.md
  2. 16
      config.js
  3. 124
      package-lock.json
  4. 1925
      php.ini
  5. 120
      php.js
  6. 14
      plugins/loader.js
  7. 40
      server.js

4
README.md

@ -22,6 +22,4 @@ Steps 1-3 will have an automated option later.
Thanks to @wbhob for donating the npm `w` package to me. Thanks to @wbhob for donating the npm `w` package to me.
Because npm versions are immutable, our public version number starts directly to `v.1.1.0`. The project should be considered unstable until `v.2.0.0` which will be WordBoxed's first stable release version. Because npm versions are immutable, our public version number starts directly to `v.1.1.0`. The project should be considered unstable until `v.2.0.0` which will be WordBox's first stable release version.
Like many software, `WordBox` will have an internal version number and external version number. The current internal version is `v.0.x.x` and external version is `v.1.x.x`. As the internal version reaches public release, it will skip over from `v.0.9.x` to `v.2.0.0` and catch up with its external version.

16
config.js

@ -2,10 +2,12 @@
const { normalize } = require('path') const { normalize } = require('path')
module.exports = module.exports = {
{ port: 8080,
port: 8080, plugins: [],
phpBin: normalize(__dirname + '/php/php-cgi'), php: {
publicPath: normalize(__dirname + '/public'), cgi: normalize(__dirname + '/php/php-cgi'),
plugins: [] ini: normalize(__dirname + '/php.ini'),
} public: normalize(__dirname + '/public'),
},
};

124
package-lock.json

@ -9,7 +9,7 @@
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz",
"integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=", "integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=",
"requires": { "requires": {
"mime-types": "2.1.17", "mime-types": "~2.1.16",
"negotiator": "0.6.1" "negotiator": "0.6.1"
} }
}, },
@ -23,7 +23,7 @@
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
"integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
"requires": { "requires": {
"color-convert": "1.9.1" "color-convert": "^1.9.0"
} }
}, },
"app-root-path": { "app-root-path": {
@ -42,15 +42,15 @@
"integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=",
"requires": { "requires": {
"bytes": "3.0.0", "bytes": "3.0.0",
"content-type": "1.0.4", "content-type": "~1.0.4",
"debug": "2.6.9", "debug": "2.6.9",
"depd": "1.1.2", "depd": "~1.1.1",
"http-errors": "1.6.2", "http-errors": "~1.6.2",
"iconv-lite": "0.4.19", "iconv-lite": "0.4.19",
"on-finished": "2.3.0", "on-finished": "~2.3.0",
"qs": "6.5.1", "qs": "6.5.1",
"raw-body": "2.3.2", "raw-body": "2.3.2",
"type-is": "1.6.15" "type-is": "~1.6.15"
} }
}, },
"bytes": { "bytes": {
@ -63,9 +63,9 @@
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz",
"integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==",
"requires": { "requires": {
"ansi-styles": "3.2.0", "ansi-styles": "^3.1.0",
"escape-string-regexp": "1.0.5", "escape-string-regexp": "^1.0.5",
"supports-color": "4.5.0" "supports-color": "^4.0.0"
} }
}, },
"color-convert": { "color-convert": {
@ -73,7 +73,7 @@
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz",
"integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==",
"requires": { "requires": {
"color-name": "1.1.3" "color-name": "^1.1.1"
} }
}, },
"color-name": { "color-name": {
@ -149,36 +149,36 @@
"resolved": "https://registry.npmjs.org/express/-/express-4.16.2.tgz", "resolved": "https://registry.npmjs.org/express/-/express-4.16.2.tgz",
"integrity": "sha1-41xt/i1kt9ygpc1PIXgb4ymeB2w=", "integrity": "sha1-41xt/i1kt9ygpc1PIXgb4ymeB2w=",
"requires": { "requires": {
"accepts": "1.3.4", "accepts": "~1.3.4",
"array-flatten": "1.1.1", "array-flatten": "1.1.1",
"body-parser": "1.18.2", "body-parser": "1.18.2",
"content-disposition": "0.5.2", "content-disposition": "0.5.2",
"content-type": "1.0.4", "content-type": "~1.0.4",
"cookie": "0.3.1", "cookie": "0.3.1",
"cookie-signature": "1.0.6", "cookie-signature": "1.0.6",
"debug": "2.6.9", "debug": "2.6.9",
"depd": "1.1.2", "depd": "~1.1.1",
"encodeurl": "1.0.1", "encodeurl": "~1.0.1",
"escape-html": "1.0.3", "escape-html": "~1.0.3",
"etag": "1.8.1", "etag": "~1.8.1",
"finalhandler": "1.1.0", "finalhandler": "1.1.0",
"fresh": "0.5.2", "fresh": "0.5.2",
"merge-descriptors": "1.0.1", "merge-descriptors": "1.0.1",
"methods": "1.1.2", "methods": "~1.1.2",
"on-finished": "2.3.0", "on-finished": "~2.3.0",
"parseurl": "1.3.2", "parseurl": "~1.3.2",
"path-to-regexp": "0.1.7", "path-to-regexp": "0.1.7",
"proxy-addr": "2.0.2", "proxy-addr": "~2.0.2",
"qs": "6.5.1", "qs": "6.5.1",
"range-parser": "1.2.0", "range-parser": "~1.2.0",
"safe-buffer": "5.1.1", "safe-buffer": "5.1.1",
"send": "0.16.1", "send": "0.16.1",
"serve-static": "1.13.1", "serve-static": "1.13.1",
"setprototypeof": "1.1.0", "setprototypeof": "1.1.0",
"statuses": "1.3.1", "statuses": "~1.3.1",
"type-is": "1.6.15", "type-is": "~1.6.15",
"utils-merge": "1.0.1", "utils-merge": "1.0.1",
"vary": "1.1.2" "vary": "~1.1.2"
}, },
"dependencies": { "dependencies": {
"setprototypeof": { "setprototypeof": {
@ -198,10 +198,10 @@
"resolved": "https://registry.npmjs.org/express-htaccess-middleware/-/express-htaccess-middleware-0.1.0.tgz", "resolved": "https://registry.npmjs.org/express-htaccess-middleware/-/express-htaccess-middleware-0.1.0.tgz",
"integrity": "sha1-n2qzO1Pw/4fNAWDBeMdj+VcFht4=", "integrity": "sha1-n2qzO1Pw/4fNAWDBeMdj+VcFht4=",
"requires": { "requires": {
"app-root-path": "1.4.0", "app-root-path": "^1.2.1",
"chalk": "1.1.3", "chalk": "^1.1.3",
"htaccess-parser": "0.1.0", "htaccess-parser": "0.1.0",
"lodash": "4.17.4" "lodash": "^4.13.1"
}, },
"dependencies": { "dependencies": {
"ansi-styles": { "ansi-styles": {
@ -214,11 +214,11 @@
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"requires": { "requires": {
"ansi-styles": "2.2.1", "ansi-styles": "^2.2.1",
"escape-string-regexp": "1.0.5", "escape-string-regexp": "^1.0.2",
"has-ansi": "2.0.0", "has-ansi": "^2.0.0",
"strip-ansi": "3.0.1", "strip-ansi": "^3.0.0",
"supports-color": "2.0.0" "supports-color": "^2.0.0"
} }
}, },
"supports-color": { "supports-color": {
@ -234,12 +234,12 @@
"integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=", "integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=",
"requires": { "requires": {
"debug": "2.6.9", "debug": "2.6.9",
"encodeurl": "1.0.1", "encodeurl": "~1.0.1",
"escape-html": "1.0.3", "escape-html": "~1.0.3",
"on-finished": "2.3.0", "on-finished": "~2.3.0",
"parseurl": "1.3.2", "parseurl": "~1.3.2",
"statuses": "1.3.1", "statuses": "~1.3.1",
"unpipe": "1.0.0" "unpipe": "~1.0.0"
}, },
"dependencies": { "dependencies": {
"statuses": { "statuses": {
@ -269,7 +269,7 @@
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
"requires": { "requires": {
"ansi-regex": "2.1.1" "ansi-regex": "^2.0.0"
} }
}, },
"has-flag": { "has-flag": {
@ -282,7 +282,7 @@
"resolved": "https://registry.npmjs.org/htaccess-parser/-/htaccess-parser-0.1.0.tgz", "resolved": "https://registry.npmjs.org/htaccess-parser/-/htaccess-parser-0.1.0.tgz",
"integrity": "sha1-j0NZviVaBkaNsYnfKkmAeGXWA3s=", "integrity": "sha1-j0NZviVaBkaNsYnfKkmAeGXWA3s=",
"requires": { "requires": {
"graceful-fs": "4.1.11" "graceful-fs": "^4.1.4"
} }
}, },
"http-errors": { "http-errors": {
@ -293,7 +293,7 @@
"depd": "1.1.1", "depd": "1.1.1",
"inherits": "2.0.3", "inherits": "2.0.3",
"setprototypeof": "1.0.3", "setprototypeof": "1.0.3",
"statuses": "1.4.0" "statuses": ">= 1.3.1 < 2"
}, },
"dependencies": { "dependencies": {
"depd": { "depd": {
@ -319,9 +319,9 @@
"integrity": "sha1-1LUFvemUaYfM8PxY2QEP+WB+P6A=" "integrity": "sha1-1LUFvemUaYfM8PxY2QEP+WB+P6A="
}, },
"lodash": { "lodash": {
"version": "4.17.4", "version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
}, },
"media-typer": { "media-typer": {
"version": "0.3.0", "version": "0.3.0",
@ -353,7 +353,7 @@
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz",
"integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=",
"requires": { "requires": {
"mime-db": "1.30.0" "mime-db": "~1.30.0"
} }
}, },
"ms": { "ms": {
@ -389,7 +389,7 @@
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.2.tgz", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.2.tgz",
"integrity": "sha1-ZXFQT0e7mI7IGAJT+F3X4UlSvew=", "integrity": "sha1-ZXFQT0e7mI7IGAJT+F3X4UlSvew=",
"requires": { "requires": {
"forwarded": "0.1.2", "forwarded": "~0.1.2",
"ipaddr.js": "1.5.2" "ipaddr.js": "1.5.2"
} }
}, },
@ -425,18 +425,18 @@
"integrity": "sha512-ElCLJdJIKPk6ux/Hocwhk7NFHpI3pVm/IZOYWqUmoxcgeyM+MpxHHKhb8QmlJDX1pU6WrgaHBkVNm73Sv7uc2A==", "integrity": "sha512-ElCLJdJIKPk6ux/Hocwhk7NFHpI3pVm/IZOYWqUmoxcgeyM+MpxHHKhb8QmlJDX1pU6WrgaHBkVNm73Sv7uc2A==",
"requires": { "requires": {
"debug": "2.6.9", "debug": "2.6.9",
"depd": "1.1.2", "depd": "~1.1.1",
"destroy": "1.0.4", "destroy": "~1.0.4",
"encodeurl": "1.0.1", "encodeurl": "~1.0.1",
"escape-html": "1.0.3", "escape-html": "~1.0.3",
"etag": "1.8.1", "etag": "~1.8.1",
"fresh": "0.5.2", "fresh": "0.5.2",
"http-errors": "1.6.2", "http-errors": "~1.6.2",
"mime": "1.4.1", "mime": "1.4.1",
"ms": "2.0.0", "ms": "2.0.0",
"on-finished": "2.3.0", "on-finished": "~2.3.0",
"range-parser": "1.2.0", "range-parser": "~1.2.0",
"statuses": "1.3.1" "statuses": "~1.3.1"
}, },
"dependencies": { "dependencies": {
"statuses": { "statuses": {
@ -451,9 +451,9 @@
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.1.tgz", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.1.tgz",
"integrity": "sha512-hSMUZrsPa/I09VYFJwa627JJkNs0NrfL1Uzuup+GqHfToR2KcsXFymXSV90hoyw3M+msjFuQly+YzIH/q0MGlQ==", "integrity": "sha512-hSMUZrsPa/I09VYFJwa627JJkNs0NrfL1Uzuup+GqHfToR2KcsXFymXSV90hoyw3M+msjFuQly+YzIH/q0MGlQ==",
"requires": { "requires": {
"encodeurl": "1.0.1", "encodeurl": "~1.0.1",
"escape-html": "1.0.3", "escape-html": "~1.0.3",
"parseurl": "1.3.2", "parseurl": "~1.3.2",
"send": "0.16.1" "send": "0.16.1"
} }
}, },
@ -472,7 +472,7 @@
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"requires": { "requires": {
"ansi-regex": "2.1.1" "ansi-regex": "^2.0.0"
} }
}, },
"supports-color": { "supports-color": {
@ -480,7 +480,7 @@
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
"integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
"requires": { "requires": {
"has-flag": "2.0.0" "has-flag": "^2.0.0"
} }
}, },
"type-is": { "type-is": {
@ -489,7 +489,7 @@
"integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=", "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=",
"requires": { "requires": {
"media-typer": "0.3.0", "media-typer": "0.3.0",
"mime-types": "2.1.17" "mime-types": "~2.1.15"
} }
}, },
"unpipe": { "unpipe": {

1925
php.ini

File diff suppressed because it is too large

120
php.js

@ -1,31 +1,26 @@
// The base work for this module was found at 'use strict';
// https://npmjs.com/package/node-php
// All credits to original author
// I've ES6'd and fixed deprecated Express functions
'use strict' const url = require('url');
const child = require('child_process');
const path = require('path');
const fs = require('fs');
const url = require('url') function runPHP(req, res, { cgi, ini, public }) {
const child = require('child_process') const parts = url.parse(req.url);
const path = require('path') const query = parts.query;
const fs = require('fs')
function runPHP(req, response, next, phpdir, phpCgi) { let file = path.join(public, parts.pathname);
const parts = url.parse(req.url)
const query = parts.query
let file = path.join(phpdir, parts.pathname)
if (!fs.existsSync(file)) { if (!fs.existsSync(file)) {
file = path.join(phpdir, "index.php") file = path.join(public, "index.php");
} else if (fs.statSync(file).isDirectory()) { } else if (fs.statSync(file).isDirectory()) {
file = path.join(file, "index.php") file = path.join(file, "index.php");
} }
let pathinfo = "" let pathinfo = "";
const i = req.url.indexOf(".php") const i = req.url.indexOf(".php");
if (i > 0) pathinfo = parts.pathname.substring(i + 4) if (i > 0) pathinfo = parts.pathname.substring(i + 4);
else pathinfo = parts.pathname else pathinfo = parts.pathname;
const env = { const env = {
SERVER_SIGNATURE: "WordBox Server", SERVER_SIGNATURE: "WordBox Server",
@ -83,71 +78,64 @@ function runPHP(req, response, next, phpdir, phpCgi) {
APPL_MD_PATH: "", //The virtual path of the deepest alias which contains the request URI. If no alias contains the request URI, the variable is set to /. APPL_MD_PATH: "", //The virtual path of the deepest alias which contains the request URI. If no alias contains the request URI, the variable is set to /.
APPL_PHYSICAL_PATH: "", //The real path of the deepest alias which contains the request URI. If no alias contains the request URI, the variable is set to the same value as DOCUMENT_ROOT. APPL_PHYSICAL_PATH: "", //The real path of the deepest alias which contains the request URI. If no alias contains the request URI, the variable is set to the same value as DOCUMENT_ROOT.
IS_SUBREQ: "", //It is set to true if the current request is a subrequest, i.e. a request not directly invoked by a client. Otherwise, it is set to true. Subrequests are generated by the server for internal processing. XSSI includes for example result in subrequests. IS_SUBREQ: "", //It is set to true if the current request is a subrequest, i.e. a request not directly invoked by a client. Otherwise, it is set to true. Subrequests are generated by the server for internal processing. XSSI includes for example result in subrequests.
REDIRECT_STATUS: 1 REDIRECT_STATUS: 1,
} };
Object Object
.keys(req.headers) .keys(req.headers)
.map(x => .forEach(x =>
env["HTTP_" + x.toUpperCase().replace("-", "_")] = req.headers[x]) env["HTTP_" + x.toUpperCase().replace("-", "_")] = req.headers[x]);
if (/.*?\.php$/.test(file)) { if (/.*?\.php$/.test(file)) {
let res = "", err = "" let response = "", error = "";
const php = child.spawn(phpCgi, [], { const php = child.spawn(cgi, [ '-c', ini ], { env });
env: env
})
php.stdin.write(req.rawBody) php.stdin.write(req.rawBody);
php.stdout.on("data", data => res += data.toString()) php.stdout.on("data", data => response += data.toString());
php.stderr.on("data", () => err += err.toString()) php.stderr.on("data", data => error += data.toString());
php.on("error", err => console.error(err)) php.on("error", err => console.error(err));
php.on("exit", () => { php.on("exit", () => {
php.stdin.end() php.stdin.end();
const lines = res.split("\r\n") const lines = response.split("\r\n");
let line = 0 let line = 0;
let html = "" let html = "";
if (lines.length) { if (lines.length) {
do { do {
const m = lines[line].split(": ") const m = lines[line].split(": ");
if (m[0] === "") break if (m[0] === "") break;
if (m[0] == "Status") { if (m[0] == "Status") res.statusCode = parseInt(m[1]);
response.statusCode = parseInt(m[1]) if (m.length == 2) res.setHeader(m[0], m[1]);
} line++;
if (m.length == 2) { } while (lines[line] !== "");
response.setHeader(m[0], m[1])
} html = lines.splice(line + 1).join("\n");
line++
} while (lines[line] !== "")
html = lines.splice(line + 1).join("\n")
} else { } else {
html = res html = response;
} }
response.status(response.statusCode).send(html) res.status(res.statusCode).send(html);
response.end() res.end();
}) });
} else { } else {
response.sendFile(file) res.sendFile(file);
} }
} }
exports.cgi = function (phproot, phpCgi) { exports.cgi = function ({ php: config }) {
return function (req, res, next) { return function (req, res) {
let data = null let data = null;
//req.setEncoding('utf8') req.setEncoding('utf8');
req.on('data', function (chunk) { req.on('data', function (chunk) {
if (!data) data = chunk if (!data) data = chunk;
else data = data + chunk else data = data + chunk;
}) });
req.on('end', function () { req.on('end', function () {
req.rawBody = data || "" req.rawBody = data || "";
runPHP(req, res, next, phproot, phpCgi) runPHP(req, res, config);
}) });
} };
} };

14
plugins/loader.js

@ -1,13 +1,13 @@
'use strict' 'use strict'
const { EOL } = require('os') const { EOL } = require('os');
function plugins() { function plugins(app) {
const { plugins } = require('../config') const { plugins } = require('../config')
return plugins.map(plugin => { return plugins.map(plugin => {
require('../plugins/' + plugin + '/main.js') require('../plugins/' + plugin)(app);
console.log(EOL + 'Loaded plugin ' + plugin + '...') console.log(EOL + 'Loaded plugin ' + plugin + '...');
}) });
} };
module.exports = plugins module.exports = plugins;

40
server.js

@ -1,38 +1,26 @@
'use strict' 'use strict';
const path = require('path') const fs = require('fs');
const fs = require('fs') const { EOL } = require('os');
const { EOL } = require('os')
const express = require('express') const express = require('express');
const chalk = require('chalk') const chalk = require('chalk');
const php = require('./php') const php = require('./php');
const config = require('./config') const config = require('./config');
const plugins = require('./plugins/loader') const plugins = require('./plugins/loader');
const htaccess = require('express-htaccess-middleware') const app = express();
const RewriteOptions = {
file: path.resolve(config.publicPath, '.htaccess'),
verbose: (process.env.ENV_NODE == 'development'),
watch: (process.env.ENV_NODE == 'development'),
}
const app = express() app.use("/", php.cgi(config));
app plugins(app); // Load any plugins declared in config
.use("/", php.cgi(config.publicPath, config.phpBin))
.use(htaccess(RewriteOptions))
plugins() // Load any plugins declared in config const fancy = fs.readFileSync('./fancy.txt');
app.listen(config.port)
const fancy = fs.readFileSync('./fancy.txt')
const listeningMsg = ( const listeningMsg = (
chalk.yellow(fancy) + EOL + chalk.yellow(fancy) + EOL +
chalk.green(` Server listening on port ${config.port}` + EOL + chalk.green(` Server listening on port ${config.port}` + EOL +
'+---------------------------------+') '+---------------------------------+')
) );
console.log(listeningMsg) app.listen(config.port, () => console.log(listeningMsg));

Loading…
Cancel
Save