---
# System prepended metadata

title: Utils

---

# Utils

```javascript=
//Authentication
export function checkAuth(event) { 
  const bearer = event.headers['Authorization']
  if (bearer) {
    try {
      const decoded = jwt.verify(
        bearer.replace(/^Bearer /, ''),
        process.env.JWT_SECRET
      )
    return decoded
    } catch {
      return false
    }
  } else {
    return false
  }
}
```

```javascript=
const use = fn (req, res, next) => 
    Promise.resolve(fn(req, res, next)).catch(next)

```