Monitor App on Angular 6 and Nodejs API [closed]

0

I have designed a Web with Angular 6 and a back-end with Express and NodeJS.

I have the idea of a dashboard to monitor the number of visits, how many queries to the API perform, events click on the front ...

I'm lost and I'm not sure where to start.

I have seen that some hosting and tools do it, but in my case it is a private server and I do not have the option of hosting.

Do I have to handle events in angular and have these stored in database?

I need some kind of advice, all help is good.

Greetings and thanks.

    
asked by Manolait 13.12.2018 в 20:55
source

1 answer

2

It's a question rather of personal opinion, but I can tell you two ways you have to monitor the web and your API simply.

If you do not want to depend on third-party services.

The best solution would be to record the events that take place in a database, which you can easily return in your own dashboard.

Google Analytics

This service would be very useful when it comes to knowing data in real time, retention of users, where your users are from, etc.

Now GA has an API, with which we can create a Dashboard with the data that GA gives us about our website, although I only recommend it to be used on the web and not with the API, since in the api you make calls of all kinds, GET, POST, OPTIONS, PUT, DELETE.

Summing up

A good practice would be to use Google Analytics for web data, and to record events when users make calls to the API, for example, when you receive the call to the server, you can create an Middleware that is in charge of registering that event that has received the API , with values like, the headers, the body, the query, all this of the method req that you would receive.

Middleware that collects the call data

app.use('*', (req,res,next) => {
    console.log(req.method);

    guardarEnBD(req.method, req.headers, req.body)
    .then((data)=> {
        next()
    })
}
    
answered by 13.12.2018 / 21:44
source