0.5.0 • Published 3 years ago

wyndon v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Wyndon

Minimalist Middleware Framework

TypeScript NodeJs z

Wyndon

Wydon is a Modern Middleware Framework for creating HTTP servers which supports middleware

Why?

Why not?

Installation

> npm i wyndon

Usage

The following code shows the procedure to create a simple Server and binding it to a PORT

import { App } from 'wyndon'
// or const { App } = require('wyndon')

// Initialize App
const app = new App()
// Add your middleware
app.use((req, res, next) => {
    // Do stuff like logging and auth here
    next()
})

app.use('/', (req, res) => {
    // Write code
    res.end('This is a cool response')
})

app.use('/hi', (req, res) => {
    res.end('Hi. Cool endpoint, right?')
})


// Bind the App to a PORT
app.listen(process.env.PORT || 5000)

//Pofit!

Routing

If you want advanced routing, you can use the Router class

import { App, Router } from 'wyndon'

const app = new App()


// Every method returns the modified instance. So you can chain methods
const coolRouter = new Router()
    .use('/test', (req, res) => res.end('Working'))
    .use('/json', (req, res) => res.json({ key: 'value'}))
    .use((req, res) => 'Welcome to /route')

app.use('/route', coolRouter)
0.5.0

3 years ago

0.4.1

3 years ago

0.4.2

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.4.0

3 years ago

0.3.1

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.1

3 years ago