Skip to content

Instantly share code, notes, and snippets.

@jfhector
Created March 23, 2022 22:43
Show Gist options
  • Save jfhector/f9b425015456e92f997eebe3d8b6d636 to your computer and use it in GitHub Desktop.
Save jfhector/f9b425015456e92f997eebe3d8b6d636 to your computer and use it in GitHub Desktop.
mockExpressEndpoint
import express from 'express';
import cors from 'cors';
const PORT = 7890;
const server = express();
server.use(cors())
server.get('/me', (req, res) => {
console.log("A request was just made");
res.header('Access-Control-Allow-Origin', '*');
const response = JSON.stringify({ status: 'waiting' });
console.log("About to send response: ", response);
res.send(response);
});
server.listen(PORT, () => console.log(`Listening on port ${PORT}`));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment