Git Product home page Git Product logo

express-optimized's Introduction

Description

A minimal, optimized version of Express.

Requirements

Install

npm install express-optimized

Supported Features

Anything not listed here is not implemented

  • Router -- This is the exported class. It is used just like the normal Express Router.

    • Functions

      • handler -- A request handler function that you can pass to http(s).createServer().
      • use([path], [callback...], callback) -- path can be a single path or an array of paths. callback can be a function or another Router. Chainable.
      • all([path], [callback...], callback) -- Aliased to use().
      • VERB([path], [callback...], callback) -- Same as use() except specific to the particular HTTP verb.
      • route(path) -- Returns a Router instance that is mounted at path, relative to this router's path.
      • param(name, callback) -- Same as in Express except name is required.
    • Properties

      • path -- A string containing the base path of the router.
  • Request object (http.IncomingMessage)

    • Additional properties

      • params -- An object containing any/all route path parameters.
      • query -- An object containing any/all query parameters.
      • path -- A string containing the full requested path (minus query parameters).
      • router -- A reference to the Router instance handling this request.
  • Response object (http.ServerResponse)

    • Additional properties

      • router -- A reference to the Router instance handling this request.

express-optimized's People

Contributors

mscdex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

kalikex1

express-optimized's Issues

cannot router.use(router)

The following spec makes me think this should work:

use([path], [callback...], callback) -- path can be a single path or an array of paths. callback can be a function or another Router. Chainable.

var Router = require('express-optimized')
var a = new Router()
var b = new Router()
a.use(b)
Error: You must specify string path(s) when mounting a Router
    at Router.routerUse (node_modules\express-optimized\lib\router.js:237:11)
    at repl:1:4
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)
    at Interface._onLine (readline.js:202:10)
    at Interface._line (readline.js:531:8)
    at Interface._ttyWrite (readline.js:760:14)
    at ReadStream.onkeypress (readline.js:99:10)
    at ReadStream.EventEmitter.emit (events.js:98:17)

.VERB seems to not route correctly

The following will never hit the /test route, no matter what. Instead it is routing to the / route for some reason. Is this intended?

router.get('/', function (req, res) {
  res.end('hi!\n')
})
router.get('/test', function (req, res) {
  res.end('testing 123!\n')
})
curl http://localhost:3000/test
hi!

older path-to-regexp

would it be possible to use the 0.1.x of path-to-regexp for now? this would allow us to easily test function parity using express's own test suite

.route(path).get(fn) not working where route is string

The readme makes me think this is supported, but it seems to not function. Minimal test case:

require('express-optimized')().route('/thing').get(function(){})

Results in

Error: Cannot mount a Router in multiple places

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.