roadman
v1.1.5
Published
An efficient, and flexible NodeJS library for building backend services.
Downloads
86
Maintainers
Readme
An efficient, and flexible NodeJS library for building backend services.
Roadman Features
| Feature | Progress | | ----------------- | -------- | | CORE: expressjs, rest/graphql api, redis, queue, subscriptions | ✅ | | Couchbase - couchset orm | ✅ | | Auth & User - phone login, create user resolvers | ✅ | | Firebase - auth, storage, e.t.c | ✅ |
1. Install
npm i roadman --save
2. Basic example
import {roadman} from 'roadman';
import {Resolver, Query} from 'couchset';
// Create a demo GraphQL resolver
@Resolver()
class ExampleResolver {
@Query(() => [String], {nullable: true})
async apps(): Promise<string[]> {
return ['Apps', 'one', 'two'];
}
}
// run roadman
await roadman({resolvers: [ExampleResolver]});
3. With model automation
import {roadman} from 'roadman';
import {Model, ObjectType, InputType, Field} from 'couchset';
@InputType('PersonInput')
@ObjectType()
class Person {
@Field(() => String, {nullable: true})
id?: string = '';
@Field(() => String, {nullable: true})
firstname?: string = '';
@Field(() => String, {nullable: true})
lastname?: string = '';
@Field(() => Number, {nullable: true})
phone?: number = 0;
}
const PersonModel = new Model('Person', {graphqlType: Person});
const {resolver} = PersonModel.automate({
getById: {public: true},
createUpdate: {public: true},
pagination: {public: true},
});
await roadman({resolvers: [resolver]});
3. With auth/user resolvers
import { couchsetRoadman } from '@roadmanjs/couchset';
import { firebaseRoadman } from '@roadmanjs/firebase-admin';
import { getAuthResolvers } from '@roadmanjs/auth';
import { roadman } from "roadman";
const resolvers = [...getAuthResolvers()];
const run = async () => {
await roadman({
roadmen: [firebaseRoadman, couchsetRoadman],
resolvers,
})
}
run();