Repository navigation
Documentation
var simples = require('simples');simples(port)
port: number
var server = simples(80);or
var server = new simples(80);.start(port, callback)
port: number
callback: function(0)
server.start(80, function () {
// Application logic
});.stop(callback)
callback: function(0)
server.stop(function () {
// Application logic
});.get(route, callback)
route: string
callback: function(2)
server.get('/', function (request, response) {
// Application logic
});.post(route, callback)
route: string
callback: function(2)
server.post('/', function (request, response) {
// Application logic
});.all(route, callback)
route: string
callback: function(2)
server.all('/', function (request, response) {
// Application logic
});.getStatic(path)
path: string
path is the local path to a folder that contains static files (for example: css and js files), this folder will serve as the root folder for the server. Only one folder should be used to server static files, if more .getStatic() methods will be called only the last will be used to serve static files. The folder with static files can contain other folders, their content will be also served.
server.getStatic('root');.notFound(callback)
callback: function(2)
server.notFound(function (request, response) {
// Application logic
});.ws(path, config, callback)
path: string
config: object
callback: function(1)
server.ws('/', {
messageMaxLength: 1024,
origins: ['null'],
protocols: ['chat']
}, function (connection) {
// Application logic
});