A module for creating restful API servers and static file servers (with etags, caching, etc).
Web server is like a house, some are small and tiny, some are big and fancy. And if you're goin gto live there alone or with small family of two-three people, you don't huge mansion with 10 rooms and 15 bathrooms, it will take all your time to maintain teh thing with no clear advantage. Same with the webservers, it's easy to install all-included frameworks like express, but do you really need all of it's features all the time?
$ npm install wigwam
var http =path =Wigwam =publicDir = './public'wigwam;
1. Simplest, static files only, no api, no websockets
wigwam = http path: publicDir;console;
2. All in one
3. Step-by-step, Static + API + Websockets
// Create server instancewigwam = http;// Static fileswigwam;// API endpointswigwam;// Websocket eventswigwam;// Start listeningwigwam;console;
4. Verbose handlers
// Start with server + settingswigwam = httppath: publicDirapiPath: '/api'transformer: 'websockets';console;// GET endpointwigwam;// POST endpointwigwam;// combined events handlerwigwam;// Single event handlerwigwam;
- Better docs