Skip to content

islomkhodja/ownserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ownserver

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..

Releases

No releases published

Packages

No packages published