oxynode

1.0.1 • Public • Published

OxyNode

OxyNode is a simple node framework for developing web applications with ease

How to install?

  • Install nodeJS
  • Run npm install --save oxynode

How to use?

const OxyNode= require('oxynode');
 
 
// Initialize
const oxy= OxyNode();
 
 
// Configuration
oxy.config.$set('port', 3000);
 
 
// Route methods
var MainPage= (req,res)=> {
    res.render("./index.html", { name: "Akshay" });
};
 
var AboutPage= (req,res)=> {
    res.send("About Me");
};
 
 
// Route config
oxy.routes([
    { url: '/', callback: MainPage },
    { url: '/about', callback: AboutPage, method: 'POST' }
]);
 
 
// 404 error handler
oxy.errorHandling('404',(req,res)=> {
    res.send("Not found");
});
 
 
// Listen
oxy.listen({ port: oxy.config.$get('port') });

Event Handling

var events= oxy.pubsub();
 
events.on('message msg', ()=> {
  console.log("Hello World");
});
 
events.emit('message');
 
events.off('message');

Templating engine

const ejs= require('ejs');
oxy.config.$set('templating', ejs);

Package Sidebar

Install

npm i oxynode

Weekly Downloads

7

Version

1.0.1

License

Apache-2.0

Last publish

Collaborators

  • phenax5