This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This was the solution that I found on Stack Overflow after google searching express routes with api | |
var express = require('express') | |
var router = express.Router(); // Create our Router Middleware | |
// GET / route | |
router.get('/', function(req, res) { | |
return res.status(200).send('GET /api received!'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shortestPathWithEdge(start, finish, weight, graph) { | |
const results = {} | |
const possible = Infinity | |
let edges = getEdges(finish) | |
while (edges.length > 0) { | |
edge = edges.shift() | |
if(results[edge.v].cost === Infinity) { | |
results[edge.v] = {cost: edge.c, stack:[edge.v]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function logNumbers(start, end) { | |
for (var 1 = start; i <= end; i++) { | |
console.log(i) | |
} | |
} | |
function logRecursively(start, end) { | |
function recurse(i) { | |
console.log(i) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
class Stack { | |
constructor(capacity) { | |
this._capacity = capacity || Infinity | |
this._storage = {} | |
this._count = 0 | |
} | |
push(value) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var count = 0; | |
function cc(card) { | |
// Only change code below this line | |
switch(card) { | |
case 2: | |
case 3: | |
case 4: | |
case 5: | |
case 6: |
- Apply to 5 dream jobs
- Create 2 Frontend Templates
- Assist a fellow learner with a spec from their Get Hired goal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http') | |
http.get(process.argv[2], (res) => { | |
res.setEncoding('utf8') | |
res.on('data', console.log) | |
res.on('error', console.error) | |
}).on('error', (e) => { | |
console.error(`Got error: ${e.message}`) | |
}) |