
A Simple Web Framework for Node.js
By Nicu Micleușanu

What is simpleS?
HTTP(S) & WS(S) Servers + Clients
What are the goals of simpleS?
Simplicity (beginner friendly API) & Performance (thin abstraction)

simpleS
~186 kB
~329 kB + ~91 kB + ~1.8 MB
express + ws + request

Compare to Express
(start a server)


Compare to Express
(error handling)


Compare to Express
(middleware usage)



Virtual Hosting & Mirrors
The server can host multiple hosts and have mirrors on different ports
simpleS Server Structure
Server
Host
Router
Route
main
Mirror
...
Host
...
Router
...
Route
...

Advanced Routing
Easy and flexible routing for HTTP requests and errors
- .get(route, listener)
- .post(route, listener)
- .put(route, listener)
- .patch(route, listener)
- .delete(route, listener)
- .all(route, listener)
- .error(code, listener)
Routing methods
router.get('/user/:name/profile', (connection) => {
// Do some magic here!
});
router.error(500, (connection) => {
// Something really really bad happened here!
});
Template Engine Support
Support for third-party template engines

All-in-one solution
Most common functionality is accessible out of the box

HTTP Connection Handling
HTTP Connection Listener
getHttpHost()
getRoute()
getRouter()
applySession()
applyMiddlewares()
resolveRoute()
applyCORS()
applyCompression()
User Application Code
RESPONSE
REQUEST
WS Connection Handling
WS Connection Listener
getWsHost()
validateConnection()
prepareHandshake()
processConnection()
parseMessages()
User Application Code
REQUEST
wrapMessages()
Useful Software
- ESLint
- Tap
- Sinon
- JSInspect

To be continued ...
https://github.com/micnic/simpleS
https://www.npmjs.com/package/simples
simpleS
By Nicu Micleusanu
simpleS
- 239