Where version history becomes woven art. Hover over threads to reveal the story behind each change.
2 days ago by Alex
+ const authenticate = (req, res, next) => {
+ const token = req.headers.authorization?.split(' ')[1];
+ if (!token) return res.status(401).send('Access denied');
+ try {
+ const verified = jwt.verify(token, process.env.JWT_SECRET);
+ req.user = verified;
+ next();
+ } catch (err) {
+ res.status(400).send('Invalid token');
+ }
+ };
1 week ago by Sam
- app.get('/api/v1/old-endpoint', (req, res) => {
- // Deprecated since v2.3
- res.json({ message: "This endpoint is no longer supported" });
- });
3 weeks ago by Jordan
+ const [darkMode, setDarkMode] = useState(false);
+
+ useEffect(() => {
+ if (darkMode) {
+ document.documentElement.classList.add('dark');
+ } else {
+ document.documentElement.classList.remove('dark');
+ }
+ }, [darkMode]);
1 month ago by Taylor
- "dependencies": {
- "lodash": "^4.17.20",
- "moment": "^2.29.1",
- "request": "^2.88.2"
- }
2 months ago by Casey
+ class ErrorBoundary extends React.Component {
+ state = { hasError: false };
+
+ static getDerivedStateFromError(error) {
+ return { hasError: true };
+ }
+
+ componentDidCatch(error, errorInfo) {
+ logErrorToService(error, errorInfo);
+ }
+
+ render() {
+ if (this.state.hasError) {
+ return ;
+ }
+ return this.props.children;
+ }
+ }