/** * NodeJS-MVC 1.0 * @Author HonorLee (dev@honorlee.me) * @Version 1.0 (2018-05-04) * @License MIT */ /* * Worker Process * DO NOT CHANGE ANYTHING IN THIS FILE! */ 'use strict' global.ROOTPATH = __dirname; require('./config.js'); require('./system/core.js'); try{ require('http').createServer(serverHandler).listen(Config.Server.Port); LOGGER.info('Child Server ['+serverUID+'] start at port [' + Config.Server.Port + '] | ' + Moment().format('YYYY/MM/DD hh:mm:ss', new Date())); }catch(e){ LOGGER.error('Child Server ['+serverUID+'] failed start at port [' + Config.Server.Port + '] | ' + Moment().format('YYYY/MM/DD hh:mm:ss', new Date())); } function serverHandler(req,res){ if(req.method.toLowerCase()=='post'){ let form = new Formidable.IncomingForm(); form.parse(req, function(err, fields, files) { req._POST = fields; req._UPLOAD = files; new ROUTER(req,res); }); }else{ new ROUTER(req,res); } }