Open dstpierre opened 1 year ago
Hey @dstpierre I am keen to take this task on. Could you please assign it to me and I will try make a start this weekend?
Thanks @mauriceLC92 highly appreciated. Here's a couple of tips since you will need to modify this project core
and the cli
The cli
import the core
project, to make this work you'll need to replace the package in the cli
to say you want to use your local version:
core
and cli
there.cli
go.mod add replace github.com/staticbackendhq/core => ../core
From there you should be able to make changes in the core
to create the log middleware and the changes to config
and build the cli
. Not optimal, still trying to figure out the best workflow for this.
I'm using make build
to build the cli
and from there you will have a binary called backend
$ ./backend server --tail-log
For example testing this new flag.
Do not hesitate if you have any questions. `
Perfect, thanks for the extra tips! Will shout if I have any questions
Could be helpful to have a way to display HTTP requests info.
In the CLI program we could add a command line parameter to the
server
command, say--tail
which would display the HTTP requests being handled by the server.In the
core
package, we currently do not have alog
middleware. We'd need one and use thelogger
to ourput nice output, but only if we used the--tail
option.This means that in the
config
we would need to add a new option to indicate if we want to display the server log or not.The log middleware would be added to all middleware chains only if that config flag is true.
What I mean by middleware chains can be found in
server.go:117
:Since they are this function receive the config, the log middleware could accept a flag to be verbose or not, ex:
Assuming the
config
flag would be calledTailRequests
and the log middlewareLog
.If
TailRequests
is false the middleware simply do nothing.