Skip to content

chopinframework/next-gateway

Repository files navigation

Chopin Next.js Gateway

This adapter allows you to easily integrate Chopin to non-Next.js projects.

Deploy with Vercel

Manual Setup

  1. Host your non-Next.js project on a server with a domain name (i.e. your-project.com, your-project.herokuapp.com, etc.)
  2. Deploy this project to Vercel with your desired domain name. This will be how users will access your project.
  3. Set the DESTINATION_URL environment variable to the location that your non-Next.js project is hosted on. It must be a full URL (e.g. https://your-project.com) and cannot be an IP address.
  4. Recommended: Create a secret password that this server will use when talking to your destination server. This ensures that nobody can talk to your destination server without going through this gateway. Set the SEQUENCER_SECRET environment variable to the secret key of your sequencer. If you set this value, you must also implement middleware on your destination server that checks for this header.

Checking the secret

If you did step 4, you must check for the x-sequencer-secret header in your destination server. If it is not present, you should return a 401 Unauthorized status.

For example, if you are using Express, your middleware should look like this:

app.use((req, res, next) => {
  if (!req.headers['x-sequencer-secret'] || req.headers['x-sequencer-secret'] !== process.env.SEQUENCER_SECRET) {
    return res.status(401).send('Unauthorized');
  }

  next();
});

About

An adapter for Chopin Framework and non-Next.js apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors