Coder Social home page Coder Social logo

How to log everything about legacy HOT 7 CLOSED

nanoexpress avatar nanoexpress commented on June 4, 2024
How to log everything

from legacy.

Comments (7)

dalisoft avatar dalisoft commented on June 4, 2024

Hi @literakl

Thanks for issue, but this issue looks like a question, there you first asking about this and i think you should debug or wait to someone who already fixed issue.
Nanoexpress provided as-is for default version, as option, if you need fast support with solution, you should become sponsor.

Thanks again for interest

from legacy.

literakl avatar literakl commented on June 4, 2024

Can I make a feature request - input/output logger? It is nightmare to investigate the issues when I have no idea why nanoexpress does not send any response.

from legacy.

dalisoft avatar dalisoft commented on June 4, 2024

Yes, you can create middleware for handling these, but core of project should be same as current

from legacy.

literakl avatar literakl commented on June 4, 2024

Do you mean something like this?

function logRequest(req, res, cb) {
console.log("req = ", req);
console.log("res = ", res);
cb();
}
app.use(logRequest);

Is it put on start or end of middlewares?

from legacy.

dalisoft avatar dalisoft commented on June 4, 2024

Yes, could be like that.
Both on start and end works, but I recommend at end because of all methods and properties should be attached

from legacy.

literakl avatar literakl commented on June 4, 2024

app.use(logRequest) will put this middleware at start. How can I add it to the end for all requests? Thank you

from legacy.

dalisoft avatar dalisoft commented on June 4, 2024

If you want after all requests including routes itself, I think it is impossible, but before route, you can add it.

Like app.get(path, yourMiddleware, yourRoute)

from legacy.

Related Issues (20)

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.