What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-06 19:45:12
node js server
const http = require('http'); const hostname = '127.0.0.1'; const port = 3000; const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World'); }); server.listen(port, ... Add solution -
Javascript 2022-03-06 17:00:21
How to access the request body when POSTing using Node.js and Express
const express = require('express'); const bodyParser = require('body-parser'); const app = express(); app.use(bodyParser.urlencoded({ extended: true })); app.post('/post-test', (req, res) => { console.log('Got body:', req.body); res.sendStatu... Add solution -
Javascript 2022-03-06 09:45:08
creating a web server in js
const http = require('http'); const hostname = '127.0.0.1'; const port = 3000; const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World'); }); server.listen(port, ... Add solution -
Other 2022-03-05 22:40:08
settimeout dart
In addition to Timer mentioned by Chris, there is a Future-based API: var future = new Future.delayed(const Duration(milliseconds: 10), doStuffCallback); There is not yet direct support for cancelling a Future callback, but this works pretty well: var f... Add solution -
Javascript 2022-03-05 14:35:24
app.post('/', function (req, res) { res.send('POST request to homepage') })
var express = require("express"); var bodyParser = require("body-parser"); var app = express(); app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json()); app.get('/... Add solution -
Javascript 2022-03-04 03:25:05
express cors policy
var express = require('express') var cors = require('cors') var app = express() app.use(cors()) app.get('/products/:id', function (req, res, next) { res.json({msg: 'This is CORS-enabled for all origins!'}) }) app.listen(80, function () { console.lo... Add solution -
Python 2022-03-03 06:30:02
shared list in multiprocessing python
import multiprocessing manager = multiprocessing.Manager() shared_list = manager.list() def worker1(l): l.append(1) def worker2(l): l.append(2) process1 = multiprocessing.Process( target=worker1, args=[shared_list]) process2 = multiprocessi... Add solution -
VBA 2022-03-02 17:35:02
excel vba create recordset from table
'VBA function to create a detached, in-memory ADO recordset from an 'Excel table. This is the fastest method by far: Function RSFromExcelTable(ws As Worksheet, table) Dim sXML, oXML With ws.ListObjects(table) sXML = Union(.HeaderRowRange... Add solution