<commit_before>import {Injectable} from '@angular/core';
import {Question} from './question';
import {Http} from "@angular/http";
import 'rxjs/add/operator/toPromise';


@Injectable()
export class QuestionService {
  
  constructor(private http: Http) {
  };
  
  getQuestions(): Promise<Question[]> {
    return this.http.get('/api/question')
      .toPromise()
      .then(response => response.json() as Array<Question>)
      .catch(this.handleError);
  }
  
  private handleError(err: any): Promise<any> {
    console.error('An error occurred', err);
    return Promise.reject(err.message || err);
  }
}<commit_msg>update question service, add getQuestion<commit_after>import {Injectable} from '@angular/core';
import {Question} from './question';
import {Http} from "@angular/http";
import 'rxjs/add/operator/toPromise';


@Injectable()
export class QuestionService {
  private url = '/api/question';
  constructor(private http: Http) {
  };
  
  private handleError(err: any): Promise<any> {
    console.error('An error occurred', err);
    return Promise.reject(err.message || err);
  }
  
  getQuestions(): Promise<Question[]> {
    return this.http.get(this.url)
      .toPromise()
      .then(response => response.json() as Array<Question>)
      .catch(this.handleError);
  }
  
  getQuestion(id: string) {
    return this.http.get(this.url+'?'+id)
      .toPromise()
      .then(response => response.json() as Question)
      .catch(this.handleError);
  }
}
{'fraction_non_alphanumeric': 0.1572498298162015, 'fraction_numerical': 0.0, 'mean_word_length': 3.819672131147541, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 12, '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': '3002565', 'n_tokens_mistral': 455, 'n_tokens_neox': 454, 'n_words': 101}