title: create user with node js (findOne is not a function)
body: <p>Iam trying to create user using sequelize and postgres db. Iam trying to post to '/api/signup' but it keeps giving me an error saying thata findOne is not a function.</p>
  <p>This is how my AuthController.js looks like</p>
  <pre><code>
     exports.signup = async(req,res) =&gt;{
    
    
      const {nom,prenom, poste, telephone, email, password} = req.body;
      
  
      //Verifie si toute les donnee ont ete entree
      if(!prenom || !poste ||!telephone ||!email ||!password){
        return res.status(409).send(&quot;you may need to enter all the field&quot;);
      }
  
      //Verifie si l'utilisateur exist deja en comparant son phonenumber et le email dans ls base de donne
  
      User.findOne({
        where: {
          [Op.or]: [{telephone: telephone}, {email:email}]
        }
      })
        .then(user =&gt;{
            if((!user)){
                return res.status(409).json({message: &quot;User already exist&quot;})
            }
  
            //Hashage du mot de passe entre
  
            bcrypt.hash(password, parseInt(10))
              .then(hash =&gt;{
                req.body.password = hash;
  
                  User.create(req.body)
                  .then(user =&gt; res.json({message: &quot;User succesfully created&quot;, data:user}))
                  .catch(err =&gt; res.status(500).json({message: &quot;Data error&quot;, error:err}));
  
  
              })
              .catch(err =&gt; res.status(500).json({message: &quot;Hash process error&quot;, error:err}));
  
  
        })
          .catch(err =&gt; res.status(500).json({message: &quot;Data error&quot;, error:err}));
  
  
  
       
  }
  
  </code></pre>
  <p>This is my Authroute.js</p>
  <pre><code>const AuthController = require('../controller1/AuthController')
  const {login} = AuthController;
  const express = require('express');
  const router = express.Router()
  
  module.exports = function(app) {
      app.use(function(req, res, next) {
        res.header(
          &quot;Access-Control-Allow-Headers&quot;,
          &quot;x-access-token, Origin, Content-Type, Accept&quot;
        );
        next();
      });
  
      app.post(&quot;/signup&quot;,AuthController.signup);
  
      app.post(&quot;/signin&quot;, AuthController.signin);
  
      return app 
  }
  </code></pre>
  <p>This is my server.js</p>
  <pre><code>
  const express = require(&quot;express&quot;);
  const bodyParser = require(&quot;body-parser&quot;);
  //const cookieParser = require(&quot;cookie-parser&quot;);
  const cors = require(&quot;cors&quot;);
  const app = express();
  const router = require(&quot;./Route/index&quot;).routes
  
  var corsOptions = {
      origin: &quot;*&quot;
  };
  
  
  
  app.use(cors(corsOptions));
  //parse request of content-type - application/json
  app.use(bodyParser.json());
  //app.use(cookieParser());
  //parse request of content-type - apllication/x-ww-form-urllencoded
  app.use(bodyParser.urlencoded({
      extended:true
  }));
  
  
  
  app.use('/api', router)
  //simple route
  
  </code></pre>
  <p>After running my project i have tested on postman to see if everything is working but i had this error in my console</p>
  <pre><code>
  C:\Users\dzeufack\Desktop\flysoft_maisonier\controller1\AuthController.js:33
      User.findOne({
           ^
  
  TypeError: User.findOne is not a function
      at exports.signup (C:\Users\dzeufack\Desktop\flysoft_maisonier\controller1\AuthController.js:33:10)
      at Layer.handle [as handle_request] (C:\Users\dzeufack\Desktop\flysoft_maisonier\node_modules\express\lib\router\layer.js:95:5)
      at next (C:\Users\dzeufack\Desktop\flysoft_maisonier\node_modules\express\lib\router\route.js:144:13)
      at Route.dispatch (C:\Users\dzeufack\Desktop\flysoft_maisonier\node_modules\express\lib\router\route.js:114:3)
      at Layer.handle [as handle_request] (C:\Users\dzeufack\Desktop\flysoft_maisonier\node_modules\express\lib\router\layer.js:95:5)
      at C:\Users\dzeufack\Desktop\flysoft_maisonier\node_modules\express\lib\router\index.js:284:15
      at Function.process_params (C:\Users\dzeufack\Desktop\flysoft_maisonier\node_modules\express\lib\router\index.js:346:12)
      at next (C:\Users\dzeufack\Desktop\flysoft_maisonier\node_modules\express\lib\router\index.js:280:10)
      at C:\Users\dzeufack\Desktop\flysoft_maisonier\Route\AuthRoute.js:12:7
      at Layer.handle [as handle_request] (C:\Users\dzeufack\Desktop\flysoft_maisonier\node_modules\express\lib\router\layer.js:95:5)
  [nodemon] app crashed - waiting for file changes before starting...
  
  </code></pre>