You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> feathers g authentication
? What authentication providers do you want to use? Other PassportJS strategies not in this list can still be configured manually. Username + Password (Local)
? What is the name of the user (entity) service? users
force config/default.json
create src/authentication.js
force src/app.js
// users.models.js//const{Model}=require('objection');/* eslint-disable no-console */// messages-model.js - A Objection.js/KnexJS//// See https://vincit.github.io/objection.js and http://knexjs.org/// for more of what you can do here.classUsersextendsModel{staticgettableName(){return'users';}staticgetjsonSchema(){return{type: 'object',required: ['email','password'],properties: {id: {type: 'integer'},email: {type: 'string',pattern: String.raw`^[^@\s]+@[^@\s]+\.[^@\s]+$`},password: {type: 'string','minLength': 4}}};}}module.exports=function(app){constdb=app.get('knexClient');consttableName='users';db.schema.hasTable(tableName).then(exists=>{if(!exists){db.schema.createTable(tableName,table=>{table.increments();table.string('email').unique().notNullable();table.string('password',100).notNullable();table.timestamps(true,true);}).then(()=>console.log(`Created ${tableName} table`)).catch(e=>console.error(`Error creating ${tableName} table`,e));}});returnUsers};
// users.services.js//// Initializes the `users` service on path `/users`constobjectionService=require('feathers-objection');constcreateModel=require('../../models/users.model');consthooks=require('./users.hooks');module.exports=function(app){constModel=createModel(app);constpaginate=app.get('paginate');constoptions={model: Model,id: 'id',
paginate
};// Initialize our service with any options it requiresapp.use('/users',objectionService(options));// Get our initialized service so that we can register hooks and filtersconstservice=app.service('users');service.hooks(hooks);};
It took me a bit of time to get it working properly with this setup. Feathers out of the box is pretty intense when not using NeDB (which apparently makes everything instantly work, had to manually setup a lot of other stuff).
Which processed just fine. Which leaves me to believe possibly I have it setup a bit incorrecting using objection to find my query. Something like app.service('users').get(1).then(console.log); works properly.
The text was updated successfully, but these errors were encountered:
Figured it out. When using feathers generate authentication with files that already existed it had trouble setting authenticate hooks into users.hooks.js
Most of the project setup was using feathers-cli.
It took me a bit of time to get it working properly with this setup. Feathers out of the box is pretty intense when not using NeDB (which apparently makes everything instantly work, had to manually setup a lot of other stuff).
In the app I tried
Which processed just fine. Which leaves me to believe possibly I have it setup a bit incorrecting using objection to find my query. Something like
app.service('users').get(1).then(console.log);
works properly.The text was updated successfully, but these errors were encountered: