Backend (Node)

import express from 'express';
import fetch from 'node-fetch';

const BASE_URL = process.env.CLIQUE_BASE_URL!;
const app = express();
app.use(express.json());

app.get('/api/me', async (req, res) => {
  const r = await fetch(`${BASE_URL}/session`, { headers: { cookie: req.headers.cookie || '' } });
  const j = await r.json();
  res.status(r.status).json(j);
});

app.post('/api/ramp/coinbase', async (req, res) => {
  const r = await fetch(`${BASE_URL}/ramp/coinbase`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(req.body)
  });
  res.status(r.status).json(await r.json());
});

app.listen(3000);

Last updated