@phenyl/rest-api
TypeScript icon, indicating that this package has built-in type declarations

4.1.0 • Public • Published

@phenyl/rest-api

REST API logic. Core part of Phenyl.

example

Define a functionalGroup to create a PhenylRestApi instance. FunctionalGroup is implementation to notify Phenyl about the domain that we want to use. See here for how to set up an http server using PhenylRestApi instance. See here for how to create userDefinition and nonUserDefinition.

import {
  createEntityClient as createMongoDBClient,
  connect,
} from "@phenyl/mongodb";
import PhenylRestApi from "@phenyl/rest-api";

const connection = await connect({
  url: "mongodb://localhost:27017",
  dbname: "mydb",
});

const entityClient = createEntityClient(connection);
const sessionClient = entityClient.createSessionClient();

class NonUserDefinition {
  constructor() {}
}

const functionalGroup = {
  nonUsers: { nonUser: new NonUserDefinition() },
  users: undefined,
  customQueries: undefined,
  customCommands: undefined,
};

const restApiHandler = new PhenylRestApi(functionalGroup, {
  entityClient,
  sessionClient,
});

Readme

Keywords

none

Package Sidebar

Install

npm i @phenyl/rest-api

Weekly Downloads

220

Version

4.1.0

License

Apache-2.0

Unpacked Size

49.8 kB

Total Files

11

Last publish

Collaborators

  • shinout
  • naturalclar
  • sasurau4
  • wh1tecat
  • bowzstandard
  • alternacrow
  • camcam-lemon
  • 1natsu