What do you want to save?
Add Code snippet
New code examples
-
Other 2021-10-26 02:15:06
https.request options object parameters
var options = { hostname: 'encrypted.google.com', port: 443, path: '/', method: 'GET', key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), agent: false }; var req = https.r... Add solution -
Javascript 2021-10-22 23:04:06
https with express
const fs = require('fs'); const https = require('https'); const app = require('express')(); app.get('*', (req, res) => res.send('<h1>Hello, World</h1>')); const server = https.createServer({ key: fs.readFileSync(`${__dirname}/localhost-... Add solution -
Javascript 2021-10-22 00:37:06
js array from text file
const fs = require('fs') const makeArrayFromTextFile = (path) => { const text = fs.readFileSync(path, 'utf-8') const textByLine = text.split('\n') return textByLine } const array = makeArrayFromTextFile('./array.txt') console.log(array) // ['... Add solution -
Other 2021-10-18 14:22:05
error: error:0909006c:pem routines:get_name:no start line
You are probably using the wrong certificate file, what you need to do is generate a self signed certificate which can be done as follows openssl req -newkey rsa:2048 -new -nodes -keyout key.pem -out csr.pem openssl x509 -req -days 365 -in csr.pem -signk... Add solution -
Javascript 2021-10-16 15:23:10
How to Upload Files to a Node.js Server
/* This code comes from Vincent Lab And it has a video version linked here: https://www.youtube.com/watch?v=KP_8gN8kh4Y */ // Import dependencies const fs = require("fs"); const YAML = require("js-yaml"); const express = requi... Add solution -
Javascript 2021-10-12 13:28:02
read html file node js
const http = require("http"); //use fs module at first to read file const fs = require("fs"); const hostname = "127.0.0.1"; const port = 3000; // simple code to read file using fs module const files = fs.readFileSync("... Add solution -
Javascript 2021-09-21 21:50:02
Working with TOML in JavaScript
/* This code comes from Vincent Lab And it has a video version linked here: https://www.youtube.com/watch?v=kdZN9IOfyeE */ // Import dependencies const fs = require("fs"); const toml = require("toml"); // Read a toml file con... Add solution
Best helpers
Ranking is empty