0.0.2 • Published 4 years ago

kemboijs v0.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

CircleCI Maintainability Test Coverage License: MIT npm version npm

KemboiJS

A NodeJS API-based framework. The framework is at its initial state and development is currently being worked on. Therefore, expect to see incomplete work.

Philosophy

The current web development development is based on API and microservices. Templating usage has reduced for the past few years. In todays enterprise software, micro-services design patterns has been adopted. REST APIs tend to provide simple, stateless, and highly decoupled business worksflows. Also, more sophisticated architectures rely on API gateway that is fast. The following can be handled by REST API, SSL termination, logging, content/file compressions, authentication and authorization, caching,and even load blancing. The usage of c++ addons in nodejs community is increasing and its experimental process is one of major success. With such growth, there is a higher possibility of creating server with an optimized code as C++ allow for Single Instruction, Multiple Data (SIMD). It optimization performance during compilation. Leveraging API and C++ for better server development, kemboijs is striving towards making it better and easier to work with.

Installation

This is a NodeJS module available through npm registry. Installation is done using npm install command

$ npm install kemboijs

Tests

$ npm test

Example and Usage

const Server = require('kemboijs');

const port = 8001;
const app = new Server()

/**
 * CRUD implementation
 * POST, GET, PUT, DELETE
 */
app.get('/', (req, res) => {
    // send takes result, status(optional)
    res.send({
        result: "Hello World!",
        method: 'GET'
    }, 200)
})

app.post('/', (req, res) => {
    const { username } = req.body;
    if(!username) {
        return res.send({ message: "Please provide username "}, 400)
    }
    
    return res.send({
        result: `Hello ${username}`,
        method: 'POST'
    }, 201)
})

app.put('/', (req, res) => {
    res.send({
        result: "Hello World - Edited!",
        method: 'PUT'
    }, 200)
})

app.del('/', (req, res) => {
    res.send({
        result: "Deleted successfully",
        method: 'DELETE'
    }, 200)
})

app.listen(port, () => {
    console.log(`The server is listenng to http://127.0.0.1:${port}`)
});

Support

Issue Submission

Read submission guideline and code of conduct before opening an issue.

Contribute

There are several ways for contributing

  1. Adding new features or fixing bugs
  2. Improving documentation
  3. Raising issues and/or bugs
  4. Writing tutorials
  5. Writing tests

Please read our contribution guide and check that build pass before and your branch is updated to upstream submitting any pull request.

Licence

MIT © 2019 Ezrqn Kemboi

Disclaimer

All ideas expressed here are mine and does not does not reflect any company or organization. All contributors should also express their ideas without making associations to any organization.