Created
August 3, 2020 23:17
-
-
Save 0000marcell/14db10e737e6e068c3ecc17d33fbc3cd to your computer and use it in GitHub Desktop.
This file contains 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'), | |
app = express(), | |
cors = require('cors'), | |
bodyParser = require('body-parser'), | |
delay = 100; | |
const fs = require('fs'); | |
// read your a file called data | |
app.get('/data', function (req, res) { | |
let data = fs.readFileSync('./data.txt'); | |
res.status(200) | |
res.send(data) | |
}) | |
// post your data, write to a file caled data | |
app.post('/data', function (req, res) { | |
fs.writeFileSync('./data.txt', req.body.data, 'utf-8') | |
}) | |
app.listen(4200, function () { | |
console.log('design token running on 4200!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment