Skip to content

Instantly share code, notes, and snippets.

View jkoudys's full-sized avatar

Joshua Koudys jkoudys

View GitHub Profile
@jkoudys
jkoudys / index.js
Created July 5, 2016 13:55
Intro to NPM and Express
const express = require('express');
const userRoutes = require('./routes/users');
const app = express();
const someValue = 'foo bar';
app.get('/', function (req, res) {
// Rendering server-side can simply return an HTML string, either directly or from a template lib.
// Note that it's usually discouraged to put a whole template right in the main app - use a separate file.
document.addEventListener('DOMContentLoaded', function () {
// Grab a couple elements from the DOM
const button = document.querySelector('button');
const main = document.querySelector('main');
// Pull some data from an element
const originalColour = button.style.backgroundColor;
// Make a new Node, where we can put our results
const results = document.createElement('p');
main.appendChild(results);