<commit_before>//
//  GroupController.swift
//  App
//
//  Created by <NAME> on 01.10.17.
//

import Vapor
import HTTP

final class GroupController: ResourceRepresentable {
    typealias Model = Group
    
    /// When users call 'GET' on '/groups'
    /// it should return an index of all available groups
    func index(_ req: Request) throws -> ResponseRepresentable {
        return try Group.all().makeJSON()
    }
    
    /// When making a controller, it is pretty flexible in that it
    /// only expects closures, this is useful for advanced scenarios, but
    /// most of the time, it should look almost identical to this
    /// implementation
    func makeResource() -> Resource<Model> {
        return Resource(
            index: index
        )
    }
}

/// Since GroupController doesn't require anything to
/// be initialized we can conform it to EmptyInitializable.
///
/// This will allow it to be passed by type.
extension GroupController: EmptyInitializable { }
<commit_msg>Fix in API of Groups.<commit_after>//
//  GroupController.swift
//  App
//
//  Created by <NAME> on 01.10.17.
//

import Vapor
import HTTP

final class GroupController: ResourceRepresentable {
    typealias Model = Group
    
    /// When users call 'GET' on '/groups'
    /// it should return an index of all available groups
    func index(_ req: Request) throws -> ResponseRepresentable {
        let groups = try Group.all().makeJSON()
        var json = JSON()
        try json.set("groups", groups)
        return json
    }
    
    /// When making a controller, it is pretty flexible in that it
    /// only expects closures, this is useful for advanced scenarios, but
    /// most of the time, it should look almost identical to this
    /// implementation
    func makeResource() -> Resource<Model> {
        return Resource(
            index: index
        )
    }
}

/// Since GroupController doesn't require anything to
/// be initialized we can conform it to EmptyInitializable.
///
/// This will allow it to be passed by type.
extension GroupController: EmptyInitializable { }

{'fraction_non_alphanumeric': 0.09535218016291327, 'fraction_numerical': 0.005749880210828941, 'mean_word_length': 2.411764705882353, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '5207559', 'n_tokens_mistral': 554, 'n_tokens_neox': 530, 'n_words': 231}