Server Integrations

Jovo offers a variety of server integrations that allow you to host your apps on your own server or cloud platforms like AWS.

Introduction

The following server integrations are currently working with Jovo v4:

  • Express: Host your apps on your own server. This is also used for the local development server.
  • AWS Lambda: Host your apps on AWS Lambda serverless functions.

Usually, a server is connected to an app config stage. For example, the development stage in app.dev.ts uses Express, which you can see in the last line of the file:

export * from './server.express';

If you add a new stage using the jovov4 new:stage <stage> command (as explained in the app config docs), the Jovo CLI prompts you to select a server integration. So, for example, if you create a new prod stage and select AWS Lambda, the following line will be added to your app.prod.ts:

export * from './server.lambda';

$server Property

You can use the $server property to access specific elements from the request and response.

getRequestHeaders

You can access request headers using the getRequestHeaders() method.

Jovo converts all properties to lowercase. For example, you can access the Authorization header like this:

this.$server.getRequestHeaders().authorization;

getQueryParams

You can access query parameters using the getQueryParams() method.

this.$server.getQueryParams();

setResponseHeaders

You can set additional response headers that will be merged with existing ones using the setResponseHeaders() method.

this.$server.setResponseHeaders(header: Record<string, string>);