Skip to content

Instantly share code, notes, and snippets.

@robbestad
Created November 27, 2016 10:13
Show Gist options
  • Select an option

  • Save robbestad/6d51b3cf6d2bc67f3b012c11a8fedb34 to your computer and use it in GitHub Desktop.

Select an option

Save robbestad/6d51b3cf6d2bc67f3b012c11a8fedb34 to your computer and use it in GitHub Desktop.
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