New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

kombucha

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kombucha

Our framework

latest
Source
npmnpm
Version
1.0.10
Version published
Maintainers
1
Created
Source

Kombucha

The Kombucha Official (TKO) http Framework

How to use the Kombucha framework

Installation

npm install kombucha

To then use kombucha, you must require in ('kombucha').

const kombucha = require('kombucha')

Router Methods

  • kombucha.get('/getRoute', "desired text")
  • kombucha.post('/postRroute')
Server Methods
  • kombucha.listen( 3000 , ()=> connsole.log('server is up on 3000')) (Use this if you just want to put in the number of the port yourself. "3000" is just an example. )
  • var port = process.env.PORT; kombucha.listen(port, ()=>{ port = process.env.PORT || 3000; console.log(port); console.log('server is up on the port ' + port); }); (Use this if you want to use an environment variable. If you don't have one, it will default to port 3000, which you can change if you want.)

  • --------------------

    Setting up a route for a GET request:

    kombucha.get(pathname, [plain/text])

    Sets up a basic route on your server that will return the plain/text you give it as a second argument

    • Pathname: Any valid url character may be used in the form of a string.
    • Response[optional]: The response you want the server to send and thus be displayed on a browser if you navigate to this route. If you do not include a response it defaults to a placeholder.
    kombucha.get('/soeffervescent', "anybody got a scoby?");
    

    will print "anybody got a scoby?" when you visit /soeffervescent.

    kombucha.get('/default');
    

    kombucha.post('/yourownurl');

    
    
    <h4><a name="post-request"></a>Setting up a route for a POST request:</h4>
    
    <strong>kombucha.post(pathname, [callback])</strong>
    
    1.Pathname: Any valid url character may be used in the form of a string.
    2.Callback[optional]: A callback function with the parameters of request and response. If left black will default to an empty response.
    
    and setting up a route for a POST request is easy if you can use the default callback provided above.  Simply use the following code:
    
    

    kombucha.post('/yourownurl');

    
    Here is an example of an optional callback.
    
    
    ```kombucha.post('/sobubblysosweet', function(request, response){
          var totalData = '';
          request.on('data', function(data){
            totalData += data.toString();
          });
          request.on('end', function() {
            response.writeHead(200, {"Content-Type": "application/json"});
            response.write(totalData);
            response.end();
          });```
    
    
    
    <h4><a name="listen"></a>Starting up your server:</h4>
    
    <strong>kombucha.listen([port], [optional callback])</strong>
    
    1.Port(optional): You can set what port you want your server to be on. If you provide no arguments it will default to 3000.
    
    
    

    kombucha.listen(3000.()=>{console.log('Server is running on 3000')});

    
    Your server is now listen on port 3000.
    
    

    readme and other inspiration from Sludgy Trucker Coffee (STC)

    Docs & Dev Dependencies included:
    gulp, eslint, mocha, chai, gulp-mocha, gulp-eslint, chai http,
    

FAQs

Package last updated on 23 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts