feat: mailer internal, templates, bruno cleanup, create user, send welcome mail, mailtrap
This commit is contained in:
@@ -175,3 +175,19 @@ func (app *application) readInt(qs url.Values, key string, defaultValue int, v *
|
||||
// Otherwise, return the converted integer value.
|
||||
return i
|
||||
}
|
||||
|
||||
// The background() helper accepts an arbitrary function as a parameter.
|
||||
func (app *application) background(fn func()) {
|
||||
// Launch a background goroutine.
|
||||
go func() {
|
||||
// Recover any panic.
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
app.logger.PrintError(fmt.Errorf("%s", err), nil)
|
||||
}
|
||||
}()
|
||||
|
||||
// Execute the arbitrary function that we passed as the parameter.
|
||||
fn()
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user