0.0.2 • Published 11 months ago

gb-coder-server v0.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

gb Coder Server

this package is only some utility classes on top of express and zod to develop a small express server with validations with zod

Usage example

import { Server, Router } from 'gb-coder-server';
const userRouter = new Router('/user');
userRouter
    .get(
        '/',
        (req, res) => {
            res.okResponse('this generates a 200 Http response');
        },
        (req, res, next) => {
            console.log('this is a middleware');
            next();
        },
    )
    .get('/:id', (req, res) => {
        res.userErrorResponse('this generates a 400 error response');
    });

    const server = new Server();

    server.setRouter(userRouter);

    server.start(3000); 
0.0.2

11 months ago

0.0.1

11 months ago