https://github.com/phenax/oxynode
OxyNode is a nodeJS microframework for developing web applications with ease
https://github.com/phenax/oxynode
Last synced: 3 months ago
JSON representation
OxyNode is a nodeJS microframework for developing web applications with ease
- Host: GitHub
- URL: https://github.com/phenax/oxynode
- Owner: phenax
- Created: 2016-02-23T16:44:05.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-04-28T14:25:05.000Z (about 7 years ago)
- Last Synced: 2025-02-16T18:02:02.091Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OxyNode
OxyNode is a simple node framework for developing web applications with ease# How to install?
* Install [nodeJS](https://nodejs.org/en/)
* Run `npm install --save oxynode`# How to use?
```javascript
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
```javascript
var events= oxy.pubsub();events.on('message msg', ()=> {
console.log("Hello World");
});events.emit('message');
events.off('message');
```## Templating engine
```javascript
const ejs= require('ejs');
oxy.config.$set('templating', ejs);
```