1.0.7 • Published 4 years ago
xcofey v1.0.7
Make you developer life easier with this lib
Based in express, this lib is aimed at those who want something quick and easy, when it comes to developing APIs!
Getting started
First you need to install the lib
hello@world:~$ npm i xcofey
or
hello@world:~$ yarn add xcofey
Basics
Server
const { CreateServer } = require('xcofey');
CreateServer({
port: 3000,
controllers: [],
});
Controller (routes)
const { CreateController, Get, HttpError, HttpStatus } = require('xcofey');
const sayHelloWordRoute = Get('/hello', (req, res, next) => {
try {
return res.send('Hello Word!');
} catch(error) {
next(new HttpError(HttpStatus.INTERNAL_SERVER_ERROR, 'unexpected error');
}
});
module.exports = CreateController('/', [sayHelloWordRoute]);
Docs -> coming soon