Stand-alone and Express.js
This integration can both be used to run the tail.js server engine in a stand-alone server, or add it to an existing Express app.
# or npm or yarnpnpm add @tailjs/express
Stand-alone tail.js server
If you want to run the server stand-alone, install the package in some directory, and create a file like below.
const tailjs = require("@tailjs/express");
// "null" can also be a number that specifies the port for the server. (the default is 7411)tailjs(null /* configuration as per above. */);
Then you can start it with
node index.js
Adding as middleware to existing Express server.
import { tailjs } from "@tailjs/express";
const app = express();// Whatever your existing configuration...
tailjs(app, { client: { /* Tracker client configuration */ }, cookieKeys: [ /* Keys used for encrypting cookies */ ], extensions: [ /* Extensions for writing to a database, client IP etc. */ ],});