Set up project:
mkdir project
cd project
npm init -y| 'use strict'; | |
| // simple express server | |
| var express = require('express'); | |
| var app = express(); | |
| var router = express.Router(); | |
| app.use(express.static('public')); | |
| app.get('/', function(req, res) { | |
| res.sendfile('./public/index.html'); |
| var fs = require('fs'); | |
| var path = require('path'); | |
| var diretoryTreeToObj = function(dir, done) { | |
| var results = []; | |
| fs.readdir(dir, function(err, list) { | |
| if (err) | |
| return done(err); |
| GOPATH=$(shell pwd)/vendor:$(shell pwd) | |
| GOBIN=$(shell pwd)/bin | |
| GOFILES=$(wildcard *.go) | |
| GONAME=$(shell basename "$(PWD)") | |
| PID=/tmp/go-$(GONAME).pid | |
| build: | |
| @echo "Building $(GOFILES) to ./bin" | |
| @GOPATH=$(GOPATH) GOBIN=$(GOBIN) go build -o bin/$(GONAME) $(GOFILES) |
| /** | |
| * Given a list of items, adds and removes an active class as you hover over | |
| * them. Used to create a dropdown menu. | |
| * | |
| * Copyright (c) 2012 Blake Haswell | |
| * Licensed under the MIT license: http://opensource.org/licenses/MIT | |
| * | |
| * Example: | |
| * var items = document.getElementById("dropdown").children; | |
| * new Dropdown(items); |
| subprojects { | |
| afterEvaluate {project -> | |
| if (project.hasProperty("android")) { | |
| android { | |
| compileSdkVersion 25 | |
| buildToolsVersion '25.0.0' | |
| } | |
| } | |
| } | |
| } |
| module FileX | |
| def self.mount?(path) | |
| begin | |
| stat_path = File.lstat(path) | |
| rescue Errno | |
| # It doesn't exist so not a mount point | |
| return false | |
| end | |
| # A symlink can never be a mount point |
| # src/{{app_name}}.cr | |
| require "kemal" | |
| require "./controllers/*" | |
| alias Env = HTTP::Server::Context # this could be provided by Kemal | |
| module Main | |
| get "/", &->index(Env) | |
| get "/:name", &->greet(Env) | |
| end |
| package main | |
| import ( | |
| "context" | |
| "flag" | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "os" | |
| "os/signal" |