Skip to content

Instantly share code, notes, and snippets.

@kana-sama
Last active October 14, 2016 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kana-sama/d39d6b9ebb59e72e297002829cae9824 to your computer and use it in GitHub Desktop.
Save kana-sama/d39d6b9ebb59e72e297002829cae9824 to your computer and use it in GitHub Desktop.
hello-worlds bakends on different stacks
(ns hello-world.core
(:require [compojure.core :refer [defroutes GET]]))
(defroutes app
(GET "/hello/:name" [name]
(str "Hello " name "!")))
package main
import (
"fmt"
"github.com/go-martini/martini"
)
func main() {
m := martini.Classic()
m.Get("/hello/:name", func(params martini.Params) string {
return fmt.Sprintf("Hello %s!", params["name"])
})
m.Run()
}
const express = require('express')
const app = express()
app.get('/hello/:name', (req, res) => {
res.send(`Hello ${ req.params.name }!`)
})
app.listen()
<?php
// На самом деле это лишь один из файлов, laravel распалагается
// в большом количестве файлов и папок, не очень он мне уже нравится
Route::get('/hello/{name}', function ($name) {
return 'Hello '.$name.'!';
});
from flask import Flask
app = Flask(__name__)
@app.route('/hello/<name>')
def hello(name):
return 'Hello %s!' % name
require "sinatra"
get "hello/:name" do |name|
"Hello #{ name }!"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment