@userdashboard/express-application-server

Express middleware for Dashboard application servers

Usage no npm install needed!

<script type="module">
  import userdashboardExpressApplicationServer from 'https://cdn.skypack.dev/@userdashboard/express-application-server';
</script>

README

Express middleware for application servers

This middleware verifies requests come from your Dashboard server.

When to use this

You are integrating Dashboard with your existing or new NodeJS project, and you are using Express or Connect for your HTTP server.

What it does

When pairing your web application with Dashboard a shared secret verifies requests passed between the two servers. This middleware checks the request headers and verifies the requests came from your Dashboard server. For valid requests any headers Dashboard passes to your server like 'x-accountid' and 'x-sessionid' will be bound to the request.

If the signature verification passes the request will be marked and you can decide how to proceed.

if (!req.verified) {
    res.statusCode = 500
    return res.end()
}
console.log('the user is verified', req.accountid, req.sessionid)

Development

Development takes place on Github with releases on NPM.

License

This is free and unencumbered software released into the public domain. The MIT License is provided for countries that have not established a public domain.