routes/api/users

Users API routes module.
Source:

Example

// POST api/users
// Usage:
// 1. Add the following route in your express app
app.post('/api/users', async (req, res) => { ... });

// 2. Send a POST request with user's registration information
// e.g., using axios:
const axios = require('axios');
const userData = {
  name: 'John Doe',
  email: 'johndoe@example.com',
  password: 'mypassword',
};

axios.post('http://localhost:5000/api/users', userData)
  .then(response => {
    console.log(response.data); // User's JWT
  })
  .catch(error => {
    console.error('Error:', error);
  });

Requires

  • module:express
  • module:gravatar
  • module:bcrypt
  • module:jwt
  • module:config
  • module:express-validator
  • module:models/User