Browse Source

Slight cleanup

master
Muthu Kumar 7 years ago
parent
commit
537d5e9234
  1. 5
      config.js
  2. 18
      fancy.txt
  3. 79
      package-lock.json
  4. 3
      package.json
  5. 51
      server.js

5
config.js

@ -5,8 +5,7 @@ const { normalize } = require('path')
module.exports =
{
port: 8080,
phpBin: normalize(__dirname + '/php/php-cgi.exe'),
wpPath: normalize(__dirname + '/public'),
sqlite: '',
phpBin: normalize(__dirname + '/php/php-cgi'),
publicPath: normalize(__dirname + '/public'),
plugins: []
}

18
fancy.txt

@ -0,0 +1,18 @@
+---------------------------------+
| .---. |
| /. ./| |
| .--'. ' ; |
| /__./ \ : | |
| .--'. ' \' . |
| /___/ \ | ' ' |
| ; \ \; : |
| \ ; | |
| . \ .\ ; |
| \ \ ' \ | |
| : ' |--" |
| \ \ ; |
| '---" |
+---------------------------------+
WordBox
The modern WP & PHP environment
+---------------------------------+

79
package-lock.json

@ -13,6 +13,11 @@
"negotiator": "0.6.1"
}
},
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
},
"ansi-styles": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
@ -21,6 +26,11 @@
"color-convert": "1.9.1"
}
},
"app-root-path": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-1.4.0.tgz",
"integrity": "sha1-YzXYZclkDQ+tmQBOWnkjIjjpLfo="
},
"array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
@ -183,6 +193,41 @@
}
}
},
"express-htaccess-middleware": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/express-htaccess-middleware/-/express-htaccess-middleware-0.1.0.tgz",
"integrity": "sha1-n2qzO1Pw/4fNAWDBeMdj+VcFht4=",
"requires": {
"app-root-path": "1.4.0",
"chalk": "1.1.3",
"htaccess-parser": "0.1.0",
"lodash": "4.17.4"
},
"dependencies": {
"ansi-styles": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
},
"chalk": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"requires": {
"ansi-styles": "2.2.1",
"escape-string-regexp": "1.0.5",
"has-ansi": "2.0.0",
"strip-ansi": "3.0.1",
"supports-color": "2.0.0"
}
},
"supports-color": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc="
}
}
},
"finalhandler": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.0.tgz",
@ -214,11 +259,32 @@
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"graceful-fs": {
"version": "4.1.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg="
},
"has-ansi": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
"requires": {
"ansi-regex": "2.1.1"
}
},
"has-flag": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
"integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE="
},
"htaccess-parser": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/htaccess-parser/-/htaccess-parser-0.1.0.tgz",
"integrity": "sha1-j0NZviVaBkaNsYnfKkmAeGXWA3s=",
"requires": {
"graceful-fs": "4.1.11"
}
},
"http-errors": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz",
@ -252,6 +318,11 @@
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.5.2.tgz",
"integrity": "sha1-1LUFvemUaYfM8PxY2QEP+WB+P6A="
},
"lodash": {
"version": "4.17.4",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4="
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@ -396,6 +467,14 @@
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
"integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew=="
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"requires": {
"ansi-regex": "2.1.1"
}
},
"supports-color": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",

3
package.json

@ -27,6 +27,7 @@
"homepage": "https://github.com/codefeathers/wordbox#readme",
"dependencies": {
"chalk": "^2.3.0",
"express": "^4.16.2"
"express": "^4.16.2",
"express-htaccess-middleware": "^0.1.0"
}
}

51
server.js

@ -1,43 +1,40 @@
'use strict'
const path = require('path')
const fs = require('fs')
const { EOL } = require('os')
const express = require('express')
const php = require('./php')
const chalk = require('chalk')
//const cookieParser = require('cookie-parser')
const php = require('./php')
const config = require('./config')
const plugins = require('./plugins/main')
const fancyIntro =
chalk.yellow(`
+---------------------------------+
| .---. |
| /. ./| |
| .--'. ' ; |
| /__./ \\ : | |
| .--'. ' \\' . |
| /___/ \\ | ' ' |
| ; \\ \\; : |
| \\ ; | |
| . \\ .\\ ; |
| \\ \\ ' \\ | |
| : ' |--" |
| \\ \\ ; |
| '---" |
+---------------------------------+
WordBox
The modern WP & PHP environment
+---------------------------------+`) + chalk.green(`
Server running at port ${config.port}
+---------------------------------+
`)
const htaccess = require('express-htaccess-middleware')
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(cookieParser())
app
.use("/", php.cgi(config.wpPath, config.phpBin))
.use("/", php.cgi(config.publicPath, config.phpBin))
.use(htaccess(RewriteOptions))
.listen(config.port)
console.log(fancyIntro)
const fancy = fs.readFileSync('./fancy.txt')
const listeningMsg = (
chalk.yellow(fancy) + EOL +
chalk.green(` Server listening on port ${config.port}` + EOL +
'+---------------------------------+')
)
console.log(listeningMsg)
plugins() // Run any plugins you need to while server runs

Loading…
Cancel
Save