https://github.com/islomkhodja/ownserver
micro web framework.
https://github.com/islomkhodja/ownserver
http microframework nodejs ownserver unicon
Last synced: 6 months ago
JSON representation
micro web framework.
- Host: GitHub
- URL: https://github.com/islomkhodja/ownserver
- Owner: islomkhodja
- Created: 2018-04-05T13:22:25.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-12-06T04:18:48.000Z (about 1 year ago)
- Last Synced: 2025-04-08T01:01:40.558Z (10 months ago)
- Topics: http, microframework, nodejs, ownserver, unicon
- Language: JavaScript
- Homepage:
- Size: 40 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# ownserver
```javascript
const http = require('http');
const finalhandler = require('finalhandler');
const Server = require('../');
const server = new Server();
server.setRoute('/', {
method: "GET",
handler: (req, res) => {
res.end('This is main page')
},
})
server.setRoute('/:1/:2', {
method: "GET",
handler: (args, req, res, err) => {
res.end('This is main page', args[1], args[2]);
}
}, {
method: "POST",
handler: (args, req, res, err) => {
res.end("this is sparta!!");
}
});
http.createServer(function(req, res) {
server(req, res, finalhandler(req, res))
}).listen(3000);
```
example papkasida ham bor..