Skip to content

Instantly share code, notes, and snippets.

@devmeireles
Created January 18, 2019 13:20
Show Gist options
  • Save devmeireles/577aad7e3f417ccb34cc5fdd12a9944f to your computer and use it in GitHub Desktop.
Save devmeireles/577aad7e3f417ccb34cc5fdd12a9944f to your computer and use it in GitHub Desktop.
const http = require('http')
const port = 3000
const ip = 'localhost'
var fs = require('fs')
var teams = 'data/static/teams.json'
var matches = {};
const server = http.createServer((req, res) => {
})
server.listen(port, ip, () => {
var teams = ['Arsenal', 'Liverpool', 'Spurs', 'Chelsea']
var mergedTeams = teams.concat(teams)
var rounds = teams.length - 1
while(rounds){
for(var i=0; i<teams.length; i++) {
var link = i+rounds
var home = teams[i]
var away = mergedTeams[link]
matches[teams[i],[rounds]] = [[home],[away]]
//$matches[$team][$weeks] = array('home' => $home, 'away' => $away);
}
rounds--
}
console.log(matches)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment