Skip to content

Commit

Permalink
modified login and signup route.
Browse files Browse the repository at this point in the history
  • Loading branch information
sakibcy committed May 14, 2024
1 parent 4fb08b0 commit 02ec9a6
Show file tree
Hide file tree
Showing 28 changed files with 988 additions and 25 deletions.
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PORT=3001
CREDENTIALS=

PGHOST=localhost
PGUSER=process.env.USER
PGDATABASE=process.env.USER
PGPASSWORD=null
PGPORT=5432
12 changes: 12 additions & 0 deletions .idea/material_theme_project_new.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/select-and-tranalate-backend.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

161 changes: 161 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

90 changes: 90 additions & 0 deletions dist/apis/googleTranslateAPI_v2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSupportedLanguagesV2 = exports.translateTextV2 = exports.detectLanguageV2 = void 0;
const v2_1 = require("@google-cloud/translate/build/src/v2");
const dotenv = __importStar(require("dotenv"));
dotenv.config();
// Your credentials
const CREDENTIALS = JSON.parse(`${(_a = process.env.CREDENTIALS) === null || _a === void 0 ? void 0 : _a.toString()}`);
// Configuration for the client
const translate = new v2_1.Translate({
credentials: CREDENTIALS,
projectId: CREDENTIALS.project_id
});
const detectLanguageV2 = async (text) => {
try {
let response = await translate.detect(text);
return response[0].language;
}
catch (error) {
console.log(`Error at detectLanguage --> ${error}`);
return 0;
}
};
exports.detectLanguageV2 = detectLanguageV2;
// detectLanguageV2('Oggi è lunedì')
// .then((res) => {
// console.log(res);
// })
// .catch((err) => {
// console.log(err);
// });
const translateTextV2 = async (text, targetLanguage) => {
try {
let [response] = await translate.translate(text, targetLanguage);
return response;
}
catch (error) {
console.log(`Error at translateText --> ${error}`);
return 0;
}
};
exports.translateTextV2 = translateTextV2;
// translateTextV2('Oggi è lunedì', 'en')
// .then((res) => {
// console.log(res);
// })
// .catch((err) => {
// console.log(err);
// });
const getSupportedLanguagesV2 = async () => {
try {
const res = await translate.getLanguages();
return res[0];
}
catch (error) {
console.log(error);
}
};
exports.getSupportedLanguagesV2 = getSupportedLanguagesV2;
// getLanguagesV2()
// .then((res) => {
// console.log(res);
// })
// .catch((err) => {
// console.log(err);
// });
Loading

0 comments on commit 02ec9a6

Please sign in to comment.