Coder Social home page Coder Social logo

htdangkhoa / pure-http Goto Github PK

View Code? Open in Web Editor NEW
168.0 7.0 8.0 672 KB

✨ The simple web framework for Node.js with zero dependencies.

Home Page: https://htdangkhoa.github.io/pure-http/

License: MIT License

JavaScript 98.70% CSS 0.05% HTML 1.25%
http http-server node middleware framework webserver expressjs javascript router zero-dependency

pure-http's People

Contributors

depfu[bot] avatar htdangkhoa avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pure-http's Issues

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 :)

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?

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.