Skip to content

Instantly share code, notes, and snippets.

@w7089
Created January 10, 2019 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save w7089/3ae18386244ee2ce80a408f011dc0892 to your computer and use it in GitHub Desktop.
Save w7089/3ae18386244ee2ce80a408f011dc0892 to your computer and use it in GitHub Desktop.
server.js
var express = require('express')
var fs = require('fs')
var app = express()
app.get('/', function(req, res) {
// contents = fs.readFileSync('index.html')
res.sendFile(__dirname + '/index.html', (err)=> {
if (err) {
res.status(500).send(err)
}
})
}
)
json = {hi : "there"}
app.get('/data', (req, res) => {
res.json(json)
})
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment