0.2.33 • Published 17 days ago

wudu-server v0.2.33

Weekly downloads
102
License
MIT
Repository
-
Last release
17 days ago

Welcome to wudu-server

This is a lightweight backend framework for NodeJS.

Pros

  • ES6
  • Modular
  • Convenient approach to backend logic and flow
  • Impact on performance: close to none!
  • Plug-n-play: no dependencies required
  • No compilers, transpilers or processors - WYSIWYG

Cons

  • Requires basic understanding of backend programming

Benchmark

  • Machine: Windows 10 Pro 10.0.18363 Build 18363, Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz, 3301 Mhz, 10 Core(s), 20 Logical Processor(s), 64GB RAM
  • Method: autocannon -c 100 -d 40 -p 10 http://localhost:3000/ (best avg score in 3 runs)
  • Node: 15.3.0
  • Run: Sun Jan 24 2021 14:12:10

Benchmark setup

Comparing to leading frameworks with routing on the market (by corresponding setups):

FrameworkVersionRequests/sLatencyThroughput/MB
wudu-server0.2.948101.620.498.27
fastify3.10.143312.222.68.1
express4.17.112856.277.242.4

Prerequisites

  • NodeJS >= 15.3.0
  • NPM

Installation

npm i wudu-server

Create Simple Server

Suggested project structure

Project directory
 ├ client
 |  ┖ index.html
 ├ server
 |  ┖ endpoints
 |     ┖ IndexEndpoint.js
 ┕ index.js

Code

index.js

import { App, Router, Server } from 'wudu-server';
import IndexEndpoint from "./src/server/endpoints/IndexEndpoint.js";

// create new application
let app = new App();

// assign router to your app
app.router = Router.handler;

// add endpoint to your router
Router.addEndpoints(IndexEndpoint);

// run your app as a server
app.runServer({
    protocol: Server.HTTP,
    port: 80
});

server/endpoints/IndexEndpoint.js

export default class IndexEndpoint {
    static ['GET /'] (req, res) {
        res.file('./client/index.html', {ifModifiedSince: req.headers['if-modified-since']});
    }
}

client/index.html

<!DOCTYPE html>
<html>
<head></head>
<body>Hello, world!</body>
</html>

HTTPS

You can start an HTTPS server by replacing the corresponding code in index.js by the following:

// run your app as a server
app.runServer({
    protocol: Server.HTTPS,
    port: 443,
    options: { // corresponds to native NodeJS https config
        key: fs.readFileSync('PATH_TO_KEY'),
        cert: fs.readFileSync('PATH_TO_CERT'),
        ...
    }
});

Run

node index.js

CHANGELOG

DOCUMENTATION

Bugs and Issues

Feel free to open bugs, issues or suggest improvements here.

0.2.30

18 days ago

0.2.33

17 days ago

0.2.32

17 days ago

0.2.31

17 days ago

0.2.29

18 days ago

0.2.28

18 days ago

0.2.27

1 year ago

0.2.26

2 years ago

0.2.25

2 years ago

0.2.24

2 years ago

0.2.23

2 years ago

0.2.22

2 years ago

0.2.21

2 years ago

0.2.20

2 years ago

0.2.19

2 years ago

0.2.18

2 years ago

0.2.17

2 years ago

0.2.16

2 years ago

0.2.15

3 years ago

0.2.14

3 years ago

0.2.13

3 years ago

0.2.12

3 years ago

0.2.11

3 years ago

0.2.10

3 years ago

0.2.9

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.8

3 years ago

0.2.5

3 years ago

0.2.3

3 years ago

0.2.4

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.13

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.2

3 years ago

0.1.3

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.1

3 years ago