Skip to content

Instantly share code, notes, and snippets.

@chrvadala
Last active March 27, 2020 21:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrvadala/a43be39ce1972efe1b11dfeb3b040f4b to your computer and use it in GitHub Desktop.
Save chrvadala/a43be39ce1972efe1b11dfeb3b040f4b to your computer and use it in GitHub Desktop.
node.js api webserver
const express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');
const app = express();
const PORT = process.env.PORT || 3000;
app.use(cors());
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());
app.get('/', (req, res, next) => {
res.status(200).json({ok: true});
});
app.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