http   71501

« earlier    

javascript - Node.js: get path from the request - Stack Overflow
var http = require('http');
var url = require('url');
var fs = require('fs');

var neededstats = [];

http.createServer(function(req, res) {
if (req.url == '/index.html' || req.url == '/') {
fs.readFile('./index.html', function(err, data) {
} else {
var p = __dirname + '/' + req.params.filepath;
fs.stat(p, function(err, stats) {
if (err) {
throw err;
}).listen(8080, '');
console.log('Server running.');
stackoverflow  nodejs  node  http 
8 hours ago by ndf
unix - Travis start server and continue with scripts - Stack Overflow
So the question is, how can I run the server in the background/new instance so it doesn't conflict with that? I do stop the server with the end_script so I don't have to terminate it.

This is my travis-config so far:

language: node_js
- "6.1"
— node_modules
- npm install
- sh -e node ./test/server.js
- ./node_modules/mocha-phantomjs/bin/mocha-phantomjs ./test/browser/jelly.html
- ./node_modules/mocha-phantomjs/bin/mocha-phantomjs ./test/browser/form.html
- ./node_modules/mocha/bin/mocha ./test/node/jelly.js
- curl http://localhost:5555/close
travis-ci  nodejs  node  stackoverflow  http  web 
9 hours ago by ndf
Testing a Node.js HTTP server with Mocha ·

You may notice that the server doesn’t start automatically. You have to call listen for anything to happen. Setting up the server like this makes require idempotent, which is a good thing.


I happen to use Mocha for testing, but the concepts described here should be applicable to other JavaScript test frameworks.

Before getting to the actual tests, there’s a little bit of boilerplate to get out of the way. The test suite should fire up the server when it starts and kill the server when it finishes.

var server = require('../lib/server');
nodejs  http  node  test  blog 
9 hours ago by ndf
mitmproxy - home
An interactive console program that allows traffic flows to be intercepted, inspected, modified and replayed.
python  http  cli 
12 hours ago by jpalat
niftylettuce/frisbee: :dog2: Modern fetch-based alternative to axios/superagent/request. Great for React Native.
frisbee - :dog2: Modern fetch-based alternative to axios/superagent/request. Great for React Native.
github  js  fetch  react  http 
13 hours ago by goodfield

« earlier    

related tags

ace  admin  administration  ajax  alternative  apache  apache2  api-design  api  archive  arduino  article  async  auth  authentication  authorization  automation  aws  backup  bash  bc  bestpractices  blog  bookmarklet  bridges  browser  browserbased  cache  cdn  cheatsheet  chrome  cli  client  code  computers  console  content  coomandline  crawler  credentials  crypto  curl  dat  data  debugging  decentralized  development  docker  drupal8  elixir  elm  express  fastly  fetch  firefox  firewall  framework  frameworks  free  ft  funny  gem  github  go  golang  government  graphql  grpc  h2  hackernews  har  header  headers  hn  hosting  html  http2  httpcaching  important  infrastructure  javascript  js  json  jsonapi  l7  latency  leak  library  lint  linux  logging  marknottingham  memory  microframework  middleware  minimalism  mocking  mocks  monitor  monitoring  mozilla  multimedia  mysql  network  networking  ngrok  node  nodejs  nsurlcredentialstorage  nsurlsession  online  opensource  optimization  page  parser  performance  philsturgeon  policy  preload  privacy  profiling  programming  protobuf  proxy  push  python  qa  rails  rate  ratelimit  react  redirect  reference  requests  resources  rest  router  rpc  ruby  rust  scaffolding  scraper  scraping  searchengine  security  selfhosting  server  servers  service  services  simplicity  software  ssl  stackoverflow  structured-rpc  stub  swift  sync  tcpip  test-stub  test  testing  tokio  tooling  toolkit  tools  trace  travis-ci  tunnel  tutorial  twirp  typescript  uk  urlcredentialstorage  urlsession  validation  vco  visualization  vmware  vro  vrops  web  web_page_dev  webarchive  webdesign  webdev  webservice  wgsi  windows  wireless 

Copy this bookmark: