Skip to content

Instantly share code, notes, and snippets.

@w7089
Created Jan 10, 2019
Embed
What would you like to do?
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