Created
November 27, 2016 10:13
-
-
Save robbestad/6d51b3cf6d2bc67f3b012c11a8fedb34 to your computer and use it in GitHub Desktop.
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
| const express = require('express'); | |
| const port = process.env.PORT || 3666; | |
| const app = express(); | |
| app.use(function (req, res, next) { | |
| res.header( | |
| "Access-Control-Allow-Origin", "http://www.foo.no" | |
| ); | |
| res.header( | |
| "Access-Control-Allow-Headers", | |
| "Origin, X-Requested-With, Content-Type, Accept" | |
| ); | |
| next(); | |
| }); | |
| app.delete('/123', function (req, res, next) { | |
| res.send('Hei... 123 er slettet...'); | |
| }); | |
| app.post('/', function (req, res, next) { | |
| res.send('Hello'); | |
| }); | |
| app.listen(port, function () { | |
| console.log(`Appen kjører på http://localhost:${port}`); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment