Git Product home page Git Product logo

pure-http's Issues

Custom error handler not being reached

If I use the following app:

import pureHttp from 'pure-http';

const app = pureHttp();

app.get('/test',
    (req, res, next) => {
        throw new Error("bad");
    },
    (req, res, next) => {
        res.send("good");
    },
);

app.use((error, req, res, next) => {
    console.log('caught error', error);
});

app.listen(8000);

If I call localhost:8000/test I expect to get a console log with "caught error". Instead the default error handler catches the error and dumps it to the response.

What am I doing wrong?

license attribution

Hi there,

Your regexToParams utility function is a 100% copy-paste of my regexparam library.

I understand you're trying to have "zero dependencies", but please either list this as a dependency or include a copy of my library's license.

As of now, you're violating the MIT license, which regexparam is protected by & distributed under.

Edit: Specifically, the [email protected] release track. All you've done is expand variable declarations onto new lines, change var to let, remove some double-negations (!!), and replace string concatenation with template literals.

Drop-in replacement for Express?

Just stumbled on this and love your approach to have a lightweight/no-dependency server. Given how similar the API looks to Express I wanted to see if I could just replace my import line and have it run but saw that pure-http returns a Server instance whereas Express returns the listener function.

Thinking that if it was a plug-and-play replacement of Express, it would make it much easier to existing projects to adopt.

(Barring that, do you have any thoughts/docs on migration?)

Thanks again for making/sharing this. Even if I can’t use it on my current app, I’ll definitely keep it in mind for the future and let others know :)

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.