0
votes

I'm building an app with ArangoDB.
In the manual, it says that there is something called Cookie transport and Session transports. https://docs.arangodb.com/3.0/Manual/Foxx/Sessions/Transports/Cookie.html

It seems that these are equilent to cookies and sessions, like ones that you get with express-session modules. However, I can't understand:
1. Why are these things called 'transport(s)' ?
2. Do Cookie transport do the same as cookies?
I'm using elixir/phoenix and other webservers behind nginx, and these servers must be able to have access to cookies.

1

1 Answers

1
votes

A Transport is a type of object. You can create such an object like this:

// use cookie based session
const cookieTransport = require('@arangodb/foxx/sessions/transports/cookie');
const myTransport = cookieTransport( ... );

// -OR-

// use header based session
const headerTransport = require('@arangodb/foxx/sessions/transports/header');
const myTransport = headerTransport( ... );

You can use the Transport object myTransport like this for example:

sessionsMiddleware({ ..., transport: myTransport });

See https://docs.arangodb.com/3.3/Manual/Foxx/Sessions/ for details.

You can also pass multiple Transport objects as array to the sessions middleware. If you don't want to change any of the default values, you can pass transport: ['header', 'cookie'] to support both cookie as well as header based session transports.

The transport defines how session IDs shall be handled on the client-side, whether a cookie or an HTTP header or both should be used to transmit the session ID to the server.