@benco112/quick-express-setup 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@benco112/quick-express-setup",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "CLI profesional para generar APIs con Express, JWT y Netlify en segundos.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -41,4 +41,4 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  }
44
- }
44
+ }
@@ -156,31 +156,31 @@ app.use(express.json());
156
156
  // AUTH
157
157
  const verificarAuth = (req, res, next) => {
158
158
  const token = req.cookies.jwt_token;
159
- if (!token) return res.status(401).json({ error: 'No autenticado' });
159
+ if (!token) return res.status(401).json({ error: 'No autenticado' });
160
160
  try {
161
161
  const user = jwt.verify(token, SECRET_KEY);
162
162
  req.user = user;
163
163
  next();
164
- } catch (err) { res.status(403).json({ error: '💀 Token inválido' }); }
164
+ } catch (err) { res.status(403).json({ error: 'Token inválido' }); }
165
165
  };
166
166
 
167
167
  router.post('/auth/login', (req, res) => {
168
168
  const { username } = req.body;
169
169
  const token = jwt.sign({ username }, SECRET_KEY, { expiresIn: '1h' });
170
170
  res.cookie('jwt_token', token, { httpOnly: true, secure: true, sameSite: 'none', maxAge: 3600000 });
171
- res.json({ mensaje: 'Login exitoso 🍪' });
171
+ res.json({ mensaje: 'Login exitoso' });
172
172
  });
173
173
 
174
174
  router.post('/auth/logout', (req, res) => {
175
175
  res.clearCookie('jwt_token', { httpOnly: true, secure: true, sameSite: 'none' });
176
- res.json({ mensaje: 'Bye bye 👋' });
176
+ res.json({ mensaje: 'Bye bye' });
177
177
  });
178
178
 
179
179
  router.get('/dashboard', verificarAuth, (req, res) => {
180
180
  res.json({ secreto: 'Datos confidenciales', usuario: req.user });
181
181
  });
182
182
 
183
- router.get('/', (req, res) => res.json({ status: 'Online 🟢' }));
183
+ router.get('/', (req, res) => res.json({ status: 'Online' }));
184
184
 
185
185
  app.use('/.netlify/functions/api', router);
186
186
  app.use('/', router);
@@ -189,8 +189,8 @@ app.use('/', router);
189
189
  if (!process.env.NETLIFY && !process.env.AWS_LAMBDA_FUNCTION_VERSION) {
190
190
  const PORT = 3000;
191
191
  app.listen(PORT, () => {
192
- console.log(\`🚀 Server: http://localhost:\${PORT}\`);
193
- console.log(\`👉 Login: http://localhost:\${PORT}/auth/login\`);
192
+ console.log(\`Server: http://localhost:\${PORT}\`);
193
+ console.log(\`Login: http://localhost:\${PORT}/auth/login\`);
194
194
  });
195
195
  }
196
196
  module.exports.handler = serverless(app);