Skip to content

πŸš€ Web Framework πŸš€ for minimalist based on tries based robust routing, easy middleware binding, and plus made with sane intention 🍻

Notifications You must be signed in to change notification settings

RobusGauli/Yberri

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Yberri-minimalist πŸš€ πŸš€ πŸš€

Yberri is a microframework for Node-js based on tries based robust routing, easy middleware binding, and plus made with sane intention.

Installation

npm install yberri --save

Yberri is FUN. (Flask friendly for python genius) ▢️

Basic useful feature list:

  const { Yberri } = require('yberri');
  
  //handler
  function home(request, response) {
  	response.jsonify({"sane" : "fun"});
  }
  
  //here is your yberri on the rock$roll
  const app = Yberri();
  app.route('/home', home);
  app.run('localhost', 4000); // host and port
  
 //seriosuly thats it. 
  

Robust Routing

Routing is based on the tries algorithm, so handler dispatch for routes is blazingly fast.

  const { Yberri } = require('yberri');
  
  //handler
  function echoName(request, response) {
    // value of dynamic path
    const { name } = request.variablePath;
  	response.jsonify({ "sane" : name });
  }
  
  //here is your yberri on the rock$roll
  const app = Yberri();
  app.route('/home/<name>', echoName);
  app.run('localhost', 4000); // host and port
  
 //seriosuly thats it. 
  

Slim Method Mapping

Routing is based on the tries algorithm, so handler dispatch for routes is blazingly fast.

  const { Yberri } = require('yberri');
  
  //handler is called for GET and POST
  function echoName(request, response) {
  	response.jsonify({ 'getpost': 'method for both get and post' });
  }
  
  //here is your yberri on the rock$roll
  const app = Yberri();
  app.route('/home', echoName, methods=['GET', 'POST']);
  app.run('localhost', 4000); // host and port
  
 //seriosuly thats it. 
  

Apply Body Parser middleware and get the content of the request with ease.

  const { Yberri, bodyParserMiddleware } = require('yberri');
  
  //middleware to your root of the app
  const app = Yberri()
    .applyMiddleware(bodyParserMiddleware);
    
  
  //handler for POST
  function echoPostRequest(request, response, name, age) {
    const body = response.body;
    console.log('Do something with  body of the request')
 	  response.jsonify({ "sane" : body });
  }
  
  
  
  
  app.route('/home/<name>/<age>', echoName, methods=['POST']);
  app.run('localhost', 4000); // host and port
  
 //Boom no extra layer of library to just parse a body. 
  

Want more features?? Write your own cool middleware and send a pull request. Plug and Play is the key! Have fun!!

πŸŽ“ License

MIT

About

πŸš€ Web Framework πŸš€ for minimalist based on tries based robust routing, easy middleware binding, and plus made with sane intention 🍻

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published