1.0.1 • Published 8 years ago

oxynode v1.0.1

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
8 years ago

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);
1.0.1

8 years ago

1.0.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago