craig-o-curtis / node-projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node.js Web Servers, Tests, Deployment

This repo contains several programs including:

  • Text server
  • Static file server serving static HTML files
  • Dictionary app serving and writing to a JSON file
  • Countdown installed globally
  • Socket chat app in the browser using web sockets
  • Socket.io terminal chat app

Run Scripts

  • Run a file with npx babel-node <file-path>
npx babel-node ./programs/request.js
  • Or with script npm run tx -- <file-path>
npm run tx -- <file-path>
// For example:
npm run tx -- ./server/plain-text.js

Make a package global:

Make Global

  1. add at top file:
#!/usr/bin/env node
  1. in package.json, add bin:
  "bin": {
    "countdown": "countdown.js"
  },
  1. run npm link

  2. run countdown

  3. remove with npm unlink

ENV Variables

  • set with $ export NODE_ENV=development
  • check with $ echo $NODE_ENV in terminal
  • use with process.env.NODE_ENV

About


Languages

Language:HTML 95.9%Language:JavaScript 4.1%Language:CSS 0.1%Language:Shell 0.0%