WordBox is a truly modern WordPress development (and deployment) environment.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1013 B

'use strict'
7 years ago
const path = require('path')
const fs = require('fs')
const { EOL } = require('os')
const express = require('express')
7 years ago
const chalk = require('chalk')
7 years ago
//const cookieParser = require('cookie-parser')
7 years ago
7 years ago
const php = require('./php')
7 years ago
const config = require('./config')
const plugins = require('./plugins/main')
7 years ago
7 years ago
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'),
}
7 years ago
const app = express()
7 years ago
7 years ago
//app.use(cookieParser())
7 years ago
app
7 years ago
.use("/", php.cgi(config.publicPath, config.phpBin))
.use(htaccess(RewriteOptions))
7 years ago
.listen(config.port)
7 years ago
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