0.0.1-76 • Published 5 years ago

@libresat/service v0.0.1-76

Weekly downloads
2
License
AGPL-3.0
Repository
gitlab
Last release
5 years ago

LibreSat Service

A minimal, modular and optionally opinionated library for building microservices for microplatforms based on GraphQL via Apollo Server and MongoDB via Mongoose. If you want to, it allows you to easily use the MTRC (Model - TypeDef - Resolver - Controller) paradigm to make your microservices maintainable and reduce boilerplate to the absolute minimum.

Part of LibreSat

Usage

See global README.

Documentation

First, setup a project directory:

$ mkdir todos
$ cd todos
$ git init
(...)
$ npm init
(...)

Next, add LibreSat Service and TypeScript:

$ npm i -s @libresat/service
$ npm i -D typescript
$ echo \
'{
  "extends": "./node_modules/@libresat/service/tsconfig.json"
}' > tsconfig.json

Now, add an index.ts and start.ts script:

$ mkdir src/
$ echo \
'import { GraphQLMongoDB as Service, loadPath } from "@libresat/service";

const service = new Service(
  "libresat-todos",
  3000,
  "mongodb://localhost:27017",
  loadPath(__dirname, "typeDefs"),
  loadPath(__dirname, "resolvers")
);

export { service };
' > src/index.ts
$ echo \
'import { service } from "./index";
const {
  name,
  description: pkgDescription,
  version,
  author,
  license,
  homepage
} = require("../package.json");

const description = `LibreSat Todos
${pkgDescription}

  Usage: libresat-todos [OPTION...]

  -p,     --port            Port to run the GraphQL server on
  -db,    --database-url    MongoDB server to connect to
  -hds,   --headers         Whether to use HTTP headers for authentication or not

Version: ${name}#${version} by ${author}
License: ${license}
More info: ${homepage}`;

service.startWithArgs(description, process.argv);
' > src/start.ts

Nice, you can start adding some MRTCs! Consider checking out LibreSat Identity for a complete example and best practices.

0.0.1-76

5 years ago

0.0.1-75

5 years ago

0.0.1-74

5 years ago

0.0.1-73

5 years ago

0.0.1-72

5 years ago

0.0.1-71

5 years ago

0.0.1-70

5 years ago

0.0.1-69

5 years ago

0.0.1-68

5 years ago

0.0.1-67

5 years ago

0.0.1-65

5 years ago

0.0.1-64

6 years ago

0.0.1-63

6 years ago

0.0.1-62

6 years ago

0.0.1-61

6 years ago

0.0.1-60

6 years ago

0.0.1-59

6 years ago

0.0.1-58

6 years ago

0.0.1-57

6 years ago

0.0.1-56

6 years ago

0.0.1-55

6 years ago

0.0.1-54

6 years ago

0.0.1-53

6 years ago

0.0.1-52

6 years ago

0.0.1-51

6 years ago

0.0.1-50

6 years ago

0.0.1-49

6 years ago

0.0.1-48

6 years ago

0.0.1-47

6 years ago

0.0.1-46

6 years ago

0.0.1-45

6 years ago

0.0.1-44

6 years ago

0.0.1-43

6 years ago

0.0.1-42

6 years ago

0.0.1-41

6 years ago

0.0.1-40

6 years ago

0.0.1-39

6 years ago

0.0.1-38

6 years ago

0.0.1-37

6 years ago

0.0.1-36

6 years ago

0.0.1-35

6 years ago

0.0.1-34

6 years ago

0.0.1-33

6 years ago

0.0.1-32

6 years ago

0.0.1-31

6 years ago

0.0.1-30

6 years ago

0.0.1-28

6 years ago

0.0.1-27

6 years ago

0.0.1-26

6 years ago

0.0.1-25

6 years ago

0.0.1-24

6 years ago

0.0.1-23

6 years ago

0.0.1-22

6 years ago

0.0.1-21

6 years ago

0.0.1-20

6 years ago

0.0.1-19

6 years ago

0.0.1-18

6 years ago

0.0.1-17

6 years ago

0.0.1-16

6 years ago

0.0.1-15

6 years ago

0.0.1-14

6 years ago

0.0.1-13

6 years ago

0.0.1-12

6 years ago

0.0.1-11

6 years ago

0.0.1-10

6 years ago

0.0.1-9

6 years ago

0.0.1-8

6 years ago

0.0.1-7

6 years ago

0.0.1-y.0

6 years ago

0.0.1-6

6 years ago

0.0.1-5

6 years ago

0.0.1-3

6 years ago

0.0.1-4

6 years ago