Skip to content

Instantly share code, notes, and snippets.

@0000marcell
Created August 3, 2020 23:17
Show Gist options
  • Save 0000marcell/14db10e737e6e068c3ecc17d33fbc3cd to your computer and use it in GitHub Desktop.
Save 0000marcell/14db10e737e6e068c3ecc17d33fbc3cd to your computer and use it in GitHub Desktop.
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