<commit_before>import { Request, Response, Next, Server } from 'restify';
import { Connection } from 'mongoose';
import { WordList, IWordList } from '../models/WordList';

export default class ListController{
    constructor(server: Server, db: Connection) {
        server.get('/list/:id', this.GetList);
        server.post('/list', this.PostList);
    }

    public GetList(req: Request, res: Response, next: Next) {
        res.send('hello ' + req.params.id);
        next();
    }

    public PostList(req: Request, res: Response, next: Next) {
        
        let data = req.body || {};
        let wordList = new WordList(data);
        wordList.save()<commit_msg>Get all list working<commit_after>import { Request, Response, Next, Server } from 'restify';
import { Connection } from 'mongoose';
import { WordList, IWordList } from '../models/WordList';

export default class ListController{
    constructor(server: Server, db: Connection) {
        server.get('/list/:id', this.GetList);
        server.get('/list', this.GetList);
        server.post('/list', this.PostList);
    }

    public GetList(req: Request, res: Response, next: Next) {
        if(req.params.id) {
            res.send('hello ' + req.params.id);
            next();
        }
        else {
            WordList.find({}, (err: any, wordlist: IWordList[]) => {
                if(err) {
                    res.send(500, err);
                    next();
                    return;
                }
                
                res.send(wordlist);
                next();
            });
        }
    }

    public PostList(req: Request, res: Response, next: Next) {
        
        let data = req.body || {};
        let wordList = new WordList(data);
        wordList.save()
{'fraction_non_alphanumeric': 0.14091680814940577, 'fraction_numerical': 0.001697792869269949, 'mean_word_length': 1.9664429530201342, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '3718451', 'n_tokens_mistral': 505, 'n_tokens_neox': 495, 'n_words': 124}