Created
April 1, 2018 22:52
-
-
Save cramhead/ef49ef9cc10afc7f6cf840b828c97dbd to your computer and use it in GitHub Desktop.
Index.js file with cors enabled
This file contains hidden or 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 = process.env.PORT || 3000 | |
const app = express(); | |
app.use('*', cors()) // todo: Add more restrictions | |
app.use('/', (req, res) => { | |
res.send(`Server says ${(new Date).toString()}`) | |
}) | |
app.listen(PORT, () => { | |
console.log(`Server running at http://127.0.0.1:${PORT}/`) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment