htdangkhoa / pure-http Goto Github PK
View Code? Open in Web Editor NEW✨ The simple web framework for Node.js with zero dependencies.
Home Page: https://htdangkhoa.github.io/pure-http/
License: MIT License
✨ The simple web framework for Node.js with zero dependencies.
Home Page: https://htdangkhoa.github.io/pure-http/
License: MIT License
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?
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, changevar
tolet
, remove some double-negations (!!
), and replace string concatenation with template literals.
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 :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.