代码拉取完成,页面将自动刷新
同步操作将从 this_lucky/ynode 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
# This file used to create base dir of a project
tip() {
echo -e "\033[31m $1 \033[0m";
}
makedirs() {
if [ -z $1 -o $1 == '/' -o $1 == '.' ] ; then
return
fi
parent_dir=`dirname $1`
makedirs $parent_dir
if [ ! -d $1 ] ; then
mkdir $1
fi
}
echo -n 'Please input the app path: '
read val
if [ -z "$val" ] ; then
tip "Command error: The app path can not be empty"
exit
fi
if [ ! -d $val ] ; then
makedirs $val
fi
#
# project structor
#
# prject
# app
# controllers
# index
# IndexController.js
# views
# index
# index.html
# modules
# runtime
#
controllerPath=$val/app/controllers/index
viewPath=$val/app/views/index
makedirs $controllerPath
makedirs $viewPath
c=$controllerPath/IndexController.js
echo "'use strict';" > $c
echo "var YNode = require('ynode');" >> $c
echo "class IndexController extends YNode.WebController {" >> $c
echo " run(req, res) {" >> $c
echo " res.end('hello ynode');" >> $c
echo " }" >> $c
echo "}" >> $c
echo "module.exports = IndexController;" >> $c
v=$val/index.js
echo "var YNode = require('ynode');" > $v
echo "var app = new YNode({" >> $v
echo " 'id': 1," >> $v
echo " 'debug': true," >> $v
echo " 'appPath': __dirname + '/app'," >> $v
echo " 'assets': 'public'" >> $v
echo "});" >> $v
echo "app.listen(8090, function(){console.log('listen on 8090');});" >> $v
echo done
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。