Last active
March 27, 2020 21:01
-
-
Save chrvadala/a43be39ce1972efe1b11dfeb3b040f4b to your computer and use it in GitHub Desktop.
node.js api webserver
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 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