<commit_before>package main

import (
	"io"
	"os"
	"syscall"

	"github.com/dvrkps/dojo/rest/internal/configuration"
	"github.com/dvrkps/dojo/rest/internal/log"
	"github.com/dvrkps/dojo/rest/internal/server"
)

func main() {
	os.Exit(run(os.Args, os.Stdout, os.Stderr))
}

const (
	exitOk   = 0
	exitErr  = 1
	exitUser = 2
)

func run(args []string, stdout, stderr io.Writer) int {
	log := log.New(stdout, stderr)

	cfg, err := configuration.New(args, stderr)
	if err != nil {
		log.Errorf("configuration: %v", err)
		return exitUser
	}

	if cfg.Verbose {
		log.Verbose()
	}

	const (
		apiAddress = "localhost:8000"
	)

	s := server.Server{
		Addr:             apiAddress,
		Log:              log,
		TerminateSignals: []os.Signal{os.Interrupt, syscall.SIGTERM},
	}<commit_msg>rest: use api as server handler<commit_after>package main

import (
	"io"
	"os"
	"syscall"

	"github.com/dvrkps/dojo/rest/internal/configuration"
	"github.com/dvrkps/dojo/rest/internal/handlers"
	"github.com/dvrkps/dojo/rest/internal/log"
	"github.com/dvrkps/dojo/rest/internal/server"
)

func main() {
	os.Exit(run(os.Args, os.Stdout, os.Stderr))
}

const (
	exitOk   = 0
	exitErr  = 1
	exitUser = 2
)

func run(args []string, stdout, stderr io.Writer) int {
	log := log.New(stdout, stderr)

	cfg, err := configuration.New(args, stderr)
	if err != nil {
		log.Errorf("configuration: %v", err)
		return exitUser
	}

	if cfg.Verbose {
		log.Verbose()
	}

	const (
		apiAddress = "localhost:8000"
	)

	api := handlers.API{}

	s := server.Server{
		Addr:             apiAddress,
		Handler:          api.Routes(),
		Log:              log,
		TerminateSignals: []os.Signal{os.Interrupt, syscall.SIGTERM},
	}
{'fraction_non_alphanumeric': 0.1520572450805009, 'fraction_numerical': 0.008348240906380441, 'mean_word_length': 3.2160804020100504, 'pattern_counts': {'":': 0, '<': 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': '5163918', 'n_tokens_mistral': 718, 'n_tokens_neox': 669, 'n_words': 126}