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
var express = require('express') | |
var app = express() | |
var session = require('express-session') | |
const port = 8000 | |
// session for local clients | |
var s1 = session({ name: 'one', secret: 'abc'}) | |
// session for remote clients | |
var s2 = session({ name: 'two', secret: 'def'}) |
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
var axios = require('axios') | |
var FormData = require('form-data') | |
var fs = require('fs') | |
const form = new FormData() | |
const url = 'http://localhost:8000' | |
//Read the file from disc | |
form.append ('file',fs.createReadStream('./test.js')) | |
axios.post (url, form, { headers: form.getHeaders()} |
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
var express = require('express') | |
var session = require('express-session') | |
var app = express() | |
var r = require('request') | |
// By default cookies are disabled, switch it on | |
var request = r.defaults( { jar:true } ) | |
app.use(session({ secret: 'keyboard cat',saveUninitialized : false, resave : false, cookie: { maxAge: 60000 }})) |