intro
Lightweight Node.js/Express framework written in TypeScript for building secured, clustered and well-designed APIs.
install
The easiest way to install deadlock.js is with npm
.
npm i --save deadlockjs
features
Here are the main features provided by deadlock.js
- full API specification in a single object
- rate limit - delay and drop requests
- ip whitelist&blacklist for rate limit
- request caching
- mysql pool
- mongodb
- request body parsing, validation and filtering
- clustering
- file upload
- cors handling
- https & http2 Support
- logs
- internal statistics (hits, execution time)
- internal api (retrieve stats, dynamically change route, ip blacklist/whitelist, etc)
examples
hello world
Here is a simple working example
const DeadLock = DeadLock; const api = routes: '/': async "Hello World" ; DeadLock ;
That's all you need to get your web server up and running!
complex example
Here is an example of a web app with custom middleware, rate limit, mysql connection, and request body validation
;; ; DeadLock .startAppapi .thenconsole.log"Server started";
Each worker will allocate a MySQL Pool with 'connectionLimit' connections.