<commit_before>package main

import (
	"net/http"

	"github.com/beatrichartz/martini-sockets"
	log "github.com/cihub/seelog"
	"github.com/go-martini/martini"
	"github.com/martini-contrib/encoder"
	"github.com/stampzilla/stampzilla-go/nodes/stampzilla-server/websocket"
)

// Webserver that serves static files

type WebServer struct {
	Config     *ServerConfig      `inject:""`
	WsClients  *websocket.Clients `inject:""`
	WebHandler *WebHandler        `inject:""`
}

func NewWebServer() *WebServer {
	return &WebServer{}
}

func (ws *WebServer) Start() {
	log.Info("Starting WEB (:" + ws.Config.WebPort + " in " + ws.Config.WebRoot + ")")

	//m := martini.Classic()
	r := martini.NewRouter()
	ma := martini.New()
	ma.Use(martini.Logger())
	ma.Use(martini.Recovery())
	ma.Use(martini.Static(ws.Config.WebRoot))
	ma.MapTo(r, (*martini.Routes)(nil))
	ma.Action(r.Handle)
	m := &martini.ClassicMartini{ma, r}

	m.Use(func(c martini.Context, w http.ResponseWriter) {
		c.MapTo(encoder.JsonEncoder{}, (*encoder.Encoder)(nil))
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
	})

	m.Get("/socket", sockets.JSON(websocket.Message{}), ws.WsClients.WebsocketRoute)

	//Nodes
	m.Get("/api/nodes", ws.WebHandler.GetNodes)
	m.Get("/api/node/:id", ws.WebHandler.GetNode)
	m.Put("/api/node/:id/cmd", ws.WebHandler.CommandToNodePut)
	m.Get("/api/node/:id/cmd/**", ws.WebHandler.CommandToNodeGet)

	//Rules
	m.Get("/api/rules", ws.WebHandler.GetRules)

	//Schedule
	m.Get("/api/schedule", ws.WebHandler.GetScheduleTasks)
	m.Get("/api/schedule/entries", ws.WebHandler.GetScheduleEntries)

	log.Critical(http.ListenAndServe(":"+ws.Config.WebPort, m))
}
<commit_msg>Changed api paths from /api/node to /api/nodes<commit_after>package main

import (
	"net/http"

	"github.com/beatrichartz/martini-sockets"
	log "github.com/cihub/seelog"
	"github.com/go-martini/martini"
	"github.com/martini-contrib/encoder"
	"github.com/stampzilla/stampzilla-go/nodes/stampzilla-server/websocket"
)

// Webserver that serves static files

type WebServer struct {
	Config     *ServerConfig      `inject:""`
	WsClients  *websocket.Clients `inject:""`
	WebHandler *WebHandler        `inject:""`
}

func NewWebServer() *WebServer {
	return &WebServer{}
}

func (ws *WebServer) Start() {
	log.Info("Starting WEB (:" + ws.Config.WebPort + " in " + ws.Config.WebRoot + ")")

	//m := martini.Classic()
	r := martini.NewRouter()
	ma := martini.New()
	ma.Use(martini.Logger())
	ma.Use(martini.Recovery())
	ma.Use(martini.Static(ws.Config.WebRoot))
	ma.MapTo(r, (*martini.Routes)(nil))
	ma.Action(r.Handle)
	m := &martini.ClassicMartini{ma, r}

	m.Use(func(c martini.Context, w http.ResponseWriter) {
		c.MapTo(encoder.JsonEncoder{}, (*encoder.Encoder)(nil))
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
	})

	m.Get("/socket", sockets.JSON(websocket.Message{}), ws.WsClients.WebsocketRoute)

	//Nodes
	m.Get("/api/nodes", ws.WebHandler.GetNodes)
	m.Get("/api/nodes/:id", ws.WebHandler.GetNode)
	m.Put("/api/nodes/:id/cmd", ws.WebHandler.CommandToNodePut)
	m.Get("/api/nodes/:id/cmd/**", ws.WebHandler.CommandToNodeGet)

	//Rules
	m.Get("/api/rules", ws.WebHandler.GetRules)

	//Schedule
	m.Get("/api/schedule", ws.WebHandler.GetScheduleTasks)
	m.Get("/api/schedule/entries", ws.WebHandler.GetScheduleEntries)

	log.Critical(http.ListenAndServe(":"+ws.Config.WebPort, m))
}

{'fraction_non_alphanumeric': 0.18705463182897863, 'fraction_numerical': 0.0005938242280285036, 'mean_word_length': 4.568595041322314, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3729924', 'n_tokens_mistral': 1343, 'n_tokens_neox': 1278, 'n_words': 180}