Hello,
Do have a example of this code sample?
Each time I try to run the code locally I get the following error:
Uncaught TypeError: Router.use() requires a middleware function but got a Object
node_modules/express/lib/router/index.js:458
Process exited with code 1
I added the users.js
file to my routes directory. I have the following code inside of the users.js
const express = require('express');
const { PermissionMiddlewareCreator } = require('forest-express-sequelize');
const router = express.Router();
const permissionMiddlewareCreator = new PermissionMiddlewareCreator('users');
// Create a User
router.post('/user', permissionMiddlewareCreator.create(), (request, response, next) => {
// TODO check if user already exist in our system
// TODO make an api request to create the user in our system
next();
});
Context
I have a website that uses auth0 to sign in. I want my website adminstrators to be able to sign in to the forestadmin without having to create a new account (or user name and password).
So as an alterlative, I will send them an invite to forest admin (through the admin). And once they sign into the admin, I want create their account on my system.
- Express Version: ~4.16.3
- Sequelize Version: ~5.15.1
- Database Dialect: mysql
- Database Version: mysq1 8
- Project Name: theCXN Development