_/_/_/ _/ _/_/ _/ _/
_/ _/_/_/_/ _/_/_/ _/ _/_/ _/ _/ _/_/ _/ _/ _/_/_/_/
_/_/ _/ _/ _/ _/_/ _/_/_/_/ _/_/ _/ _/ _/ _/
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
_/_/_/ _/_/ _/_/_/ _/ _/ _/ _/_/_/ _/ _/_/
A compact and intelligent web application framework for Node.js.
中文介绍.
Installation
$ sudo npm install -g starfruit
Features
- Compact, only 3 core files
- Intelligent, automatic route load file
- Automatic, add and modify the code without shutting down the server, and automatically compile load
- Security, automatically restart when the server crashes
- Multi-core take advantage of multi-core processing, multi-process server
- Real-time, real-time monitoring server command-line tool
Quick Start
Simple web server
All static resource files in MyProject/pub
folder.
// index.jsvar sf = fs = ; app = ;app;app;
HTTPS server:
// index.jsvar sf = fs = https = ; app = ;app; var options = key: fs cert: fs; https;
Dynamic controller
For controlling the flow of the application, which handles the events and to respond. "Events" includes changing the user's behavior and data model.
All dynamic files (.js
) in MyProject/lib
folder, CoffeeScript source files (.coffee
) in MyProject/src
folder, resource files (.layout
) in MyProject/res
folder.
// app.js// route: yoururl.com/appvar fs = sf = ; moduleexports = app = ; app { $ = this; $title = 'Starfruit'; $layout = 'res/app.layout';}; app { $ = this; $; if $data $datatimetext = ; $datatimestyle = 'color:blue'; }; app { $ = this; $; if $data if $datausername $datamessage = 'hello ' + $datausername + ', welcome to starfruit world.'; };
or maybe you more like CoffeeScript codes:
# app.coffee # route: yoururl.com/app fs = require 'fs' require 'starfruit' module.exports = : -> @title = 'Starfruit' @layout = 'res/app.layout' : -> @model time: "text""style" return unless @data @datatime.text = toString @datatime.style = 'color:blue' : -> @model username: "value" message: "text" return unless @data @datamessage = "hello , welcome to starfruit world." if @datausername
app.layout
contents:
Server time: ... Your name:
Customized server status code page
Use _<status code>.html
file to customize the server status code page, such as _404.html
. All server status code page must in MyProject/pub
folder or customized static content folder.
Command line tool
$ cd MyProject
- Boot server(enter real-time command line tool)
$ starfruit
or$ sf
- Add server process(maximum number of processes CPU cores)
add <num>
- List all server processes
list
orls
- Shutdown a process
remove <pid>
orrm <pid>
- Quit
quit
APIs
Histroy
See histroy.
License
See LICENSE.
Copyright (c) 2014 Kan Kung-Yip