<commit_before>/* eslint consistent-return:0 */

const express = require('express');
const bodyParser = require('body-parser');
const request = require('request');
const logger = require('./logger');

const argv = require('minimist')(process.argv.slice(2));
const setup = require('./middlewares/frontendMiddleware');
const isDev = process.env.NODE_ENV !== 'production';
const ngrok = (isDev && process.env.ENABLE_TUNNEL) || argv.tunnel ? require('ngrok') : false;
const resolve = require('path').resolve;
const app = express();

// If you need a backend, e.g. an API, add your custom backend-specific middleware here
// app.use('/api', myApi);

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
  extended: true,
}));

app.post('/matchandeRekryteringsbehov', (req, res) => {
  const url = 'http://pilot.arbetsformedlingen.se:80/pbv3api/rest/matchning/v1/matchandeRekryteringsbehov';
  // const url = 'https://www.arbetsformedlingen.se/rest/matchning/rest/matchning/v1/matchandeRekryteringsbehov';
  // console.log(req.body);
  request.post(url, {json: req.body}, (error, response, body) => {
    if (!error) {
      // console.log(body);
      res.json(body);
    }
  });
});

app.post('/matchandeRekryteringsbehov/:id', (req, res) => {
  const url = 'http://pilot.arbetsformedlingen.se:80/pbv3api/rest/matchning/v1/matchandeRekryteringsbehov/' + req.params.id;
  // const url = 'https://www.arbetsformedlingen.se/rest/matchning/rest/matchning/v1/matchandeRekryteringsbehov/' + req.params.id;
  // console.log(req.body);
  request.post(url, {json: req.body}, (error, response, body) => {
    if (!error) {
      // console.log(body);
      res.json(body);
    }
  });
});

app.get('/matchningskriterier', (req, res) => {
  // console.log(req);
  const url = 'http://pilot.arbetsformedlingen.se:80/pbv3api/rest/af/v1/matchning' + req.originalUrl;
  // const url = 'https://www.arbetsformedlingen.se/rest/matchning/rest/af/v1/matchning' + req.originalUrl;
  // console.log(req.body);
  request(url, (error, response, body) => {
    if (!error) {
      console.log(body);
      res.json(body);
    }
  });
});<commit_msg>add stuff<commit_after>/* eslint consistent-return:0 */

const express = require('express');
const bodyParser = require('body-parser');
const request = require('request');
const logger = require('./logger');

const argv = require('minimist')(process.argv.slice(2));
const setup = require('./middlewares/frontendMiddleware');
const isDev = process.env.NODE_ENV !== 'production';
const ngrok = (isDev && process.env.ENABLE_TUNNEL) || argv.tunnel ? require('ngrok') : false;
const resolve = require('path').resolve;
const app = express();

// If you need a backend, e.g. an API, add your custom backend-specific middleware here
// app.use('/api', myApi);

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
  extended: true,
}));

app.post('/matchandeRekryteringsbehov', (req, res) => {
  // const url = 'http://pilot.arbetsformedlingen.se:80/pbv3api/rest/matchning/v1/matchandeRekryteringsbehov';
  const url = 'https://www.arbetsformedlingen.se/rest/matchning/rest/matchning/v1/matchandeRekryteringsbehov';
  // console.log(req.body);
  request.post(url, {json: req.body}, (error, response, body) => {
    if (!error) {
      // console.log(body);
      res.json(body);
    }
  });
});

app.post('/matchandeRekryteringsbehov/:id', (req, res) => {
  // const url = 'http://pilot.arbetsformedlingen.se:80/pbv3api/rest/matchning/v1/matchandeRekryteringsbehov/' + req.params.id;
  const url = 'https://www.arbetsformedlingen.se/rest/matchning/rest/matchning/v1/matchandeRekryteringsbehov/' + req.params.id;
  // console.log(req.body);
  request.post(url, {json: req.body}, (error, response, body) => {
    if (!error) {
      // console.log(body);
      res.json(body);
    }
  });
});

app.get('/matchningskriterier', (req, res) => {
  // console.log(req);
  // const url = 'http://pilot.arbetsformedlingen.se:80/pbv3api/rest/af/v1/matchning' + req.originalUrl;
  const url = 'https://www.arbetsformedlingen.se/rest/matchning/rest/af/v1/matchning' + req.originalUrl;
  // console.log(req.body);
  request(url, (error, response, body) => {
    if (!error) {
      console.log(body);
      res.json(body);
    }
  });
});
{'fraction_non_alphanumeric': 0.18908748824082786, 'fraction_numerical': 0.00799623706491063, 'mean_word_length': 4.051068883610451, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 6, 'lorem ipsum': 0, 'www.': 6, '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': '1948991', 'n_tokens_mistral': 1534, 'n_tokens_neox': 1521, 'n_words': 243}