0.7.1 • Published 5 years ago

szelmostwo v0.7.1

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
5 years ago

Szelmostwo (very-alpha)

This is Huncwot's core engine. It is built on top of uWebSockets.js.

Key features:

  • it provides automatic request payload parsing: JSON/forms submissions, file uploads, query params, dynamic routes
  • it supports middleware-like functionality, but on per-route basis using a regular function composition
  • it comes with static file support
  • it adds security headers out-of-the-box

It is created for convenience when interfacing with uWebSockets.js. You should probably use Huncwot directly.

Był Witalis maści rudej, Niezbyt gruby, niezbyt chudy, Miał na prawym oku bielmo I był szelmą. Strasznym szelmą!

Getting Started

Save it to a file e.g. server.js, run it with node server.js and visit the application https://localhost:5544.

const Szelmostwo = require('szelmostwo');

const app = new Szelmostwo();

// implicit `return` with a `text/plain` response
app.get('/', _ => 'Hello Szelmostwo')

// explicit `return` with a 200 response of `application/json` type
app.get('/json', _ => {
  return ({ status: '200 OK', body: { a: 1, b: 2 } });
})

// set your own headers
app.get('/headers', _ => {
  return { body: 'Niezbyt gruby, Niezbyt chudy', status: '201 Created', headers: { 'Authorization': 'PASS' } }
})

// request body is parsed in `params` by default
app.post('/greet', request => {
  return `Hello POST! ${request.params.name}`;
})

app.listen(5544);
0.7.1

5 years ago

0.7.0

5 years ago

0.6.0

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.5

5 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago