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.
38 lines
933 B
38 lines
933 B
'use strict'
|
|
|
|
const path = require('path')
|
|
const fs = require('fs')
|
|
const { EOL } = require('os')
|
|
|
|
const express = require('express')
|
|
const chalk = require('chalk')
|
|
|
|
const php = require('./php')
|
|
const config = require('./config')
|
|
const plugins = require('./plugins/loader')
|
|
|
|
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("/", php.cgi(config.publicPath, config.phpBin))
|
|
.use(htaccess(RewriteOptions))
|
|
|
|
plugins() // Load any plugins declared in config
|
|
|
|
app.listen(config.port)
|
|
|
|
const fancy = fs.readFileSync('./fancy.txt')
|
|
const listeningMsg = (
|
|
chalk.yellow(fancy) + EOL +
|
|
chalk.green(` Server listening on port ${config.port}` + EOL +
|
|
'+---------------------------------+')
|
|
)
|
|
|
|
console.log(listeningMsg)
|
|
|