Skip to content

Commit

Permalink
feat: add json options rest server option
Browse files Browse the repository at this point in the history
  • Loading branch information
hperrin committed Dec 30, 2021
1 parent d3f1836 commit 35cbff4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { OptionsJson } from 'body-parser';
import express, { NextFunction, Request, Response } from 'express';
import cookieParser from 'cookie-parser';
import {
Expand Down Expand Up @@ -27,10 +28,13 @@ const NOT_FOUND_ERROR = 'Entity is not found.';
* @copyright SciActive Inc
* @see http://nymph.io/
*/
export default function createServer(nymph: Nymph) {
export default function createServer(
nymph: Nymph,
{ jsonOptions = {} }: { jsonOptions?: OptionsJson } = {}
) {
const rest = express();
rest.use(cookieParser());
rest.use(express.json());
rest.use(express.json(jsonOptions || {}));

function instantiateNymph(
_request: Request,
Expand Down

0 comments on commit 35cbff4

Please sign in to comment.