0.2.0 • Published 8 months ago

valgix-ws v0.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

Valgix Web Server

Pre-beta 1.0.x

Require from modules

const vws = require('vws')

And enjoy ;)

Example:

const vws = require('vws');

const app = new vws;

app.start(3000, 'localhost', () => {
    console.log(`Server has been started on ValgixWebServer ;)`)
}).logger();

app.go('/', {
    method: 'GET',
    handler: (req, res) => {
        res.send("Hello");
    }
})

// Fast handler method
app.go('/justpage', 'GET', (req, res) => { res.send('Hello, im Valgix ;)') })

#Middleware

const vws = require('vws');

const app = new vws;

app.start(3000, 'localhost', () => {
    console.log(`Server has been started on ValgixWebServer ;)`)
}).logger();

app.use((req, res, done) => {
    if(req.url == '/anypage') {
        return done();
    }
    
    res.send('Access denied');
})

app.go('/', {
    method: 'GET',
    handler: (req, res) => {
        res.send("Hello");
    }
})

app.go('/anypage', {
    method: 'GET',
    handler: (req, res) => {
        res.send("This is allowed page ;)");
    }
})
0.2.0

8 months ago

1.0.0

8 months ago