Created
March 23, 2022 22:43
-
-
Save jfhector/f9b425015456e92f997eebe3d8b6d636 to your computer and use it in GitHub Desktop.
mockExpressEndpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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