Muthu Kumar
7 years ago
5 changed files with 125 additions and 31 deletions
@ -0,0 +1,18 @@ |
|||
+---------------------------------+ |
|||
| .---. | |
|||
| /. ./| | |
|||
| .--'. ' ; | |
|||
| /__./ \ : | | |
|||
| .--'. ' \' . | |
|||
| /___/ \ | ' ' | |
|||
| ; \ \; : | |
|||
| \ ; | | |
|||
| . \ .\ ; | |
|||
| \ \ ' \ | | |
|||
| : ' |--" | |
|||
| \ \ ; | |
|||
| '---" | |
|||
+---------------------------------+ |
|||
WordBox |
|||
The modern WP & PHP environment |
|||
+---------------------------------+ |
@ -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…
Reference in new issue