koma
Combind model
route
controller
services
validators
... everything you want in just one module
install
> yarn add koma
start
const koma = ; koma;
Graphql-compose
const _ = ;const MongooseUtils = ;const models = MongooseUtils;const signJWT = ; moduleexports = name: "User" gql: resolvers: Mutation: Login: type: `type Login {account: Account!, jwt: String!}` args: identifier: "String!" password: "String!" hide: true resolve: async { const identifier password = args; const account = await ; if !account throw "No user founded"; const validPassword = await account; if validPassword delete accountpassword; return account jwt: ; else throw "Invalid password or username"; } SignUp: type: `type User {username: String!}` args: username: "String!" password: "String!" resolve: async { const user = await ; return user; } models: Account: schema: username: type: "string" required: true unique: true password: type: "string" select: false required: true bcrypt: true hidden: true options: timestamp: true ;