// node-fetch
const fetch = require('node-fetch')
fetch(`https://mora-bot.kr/api/v1/en2ko?text=${encodeURI(`택스트`)}`)
.then(res => res.json())
.then(json => {
console.log(json)
console.log(`입력된 값 : ${json.origin}`);
console.log(`한글 타자로 : ${json.result}`);
});
// request
let api_url = `https://mora-bot.kr/api/v1/en2ko?text=${encodeURI(`텍스트`)}`
const request = require('request');
let options = {
url: api_url
}
request.get(options, function (error, response, body) {
if (!error && response.status == 200) {
let json = JSON.parse(body)
console.log(`입력된 값 : ${json.origin}`);
console.log(`한글 타자로 : ${json.result}`);
} else {
console.log('error = ' + response.errorcode);
}
});
import requests
response = requests.get("http://mora-bot.kr/api/v1/en2ko?text=[텍스트]")
result = response.json()
if response.status == 200:
print(result)
else:
print(f"Error Code: {response.errorcode}")
// 응답 내용
{
"license":"inko module used https://www.npmjs.com/package/inko",
"status":200,
"origin":"모라",
"result":"ahfk",
"success":true
}
// node-fetch
const fetch = require('node-fetch')
fetch(`https://mora-bot.kr/api/v1/ko2en?text=${encodeURI(`텍스트`)}`)
.then(res => res.json())
.then(json => {
console.log(json
console.log(`입력된 값 : ${json.origin}`);
console.log(`한글 타자로 : ${json.result}`);
});
// request
let api_url = `https://mora-bot.kr/api/v1/ko2en?text=${encodeURI(`텍스트`)}`
const request = require('request');
let options = {
url: api_url
}
request.get(options, function (error, response, body) {
if (!error && response.status == 200) {
let json = JSON.parse(body)
console.log(`입력된 값 : ${json.origin}`);
console.log(`한글 타자로 : ${json.result}`);
} else {
console.log('error = ' + response.errorcode);
}
});
import requests
response = requests.get("https://mora-bot.kr/api/v1/ko2en?text=[텍스트]")
result = response.json()
if response.status == 200:
print(result)
else:
print(f"Error Code: {response.errorcode}")