This commit is contained in:
KLxHunter 2023-10-30 14:45:02 +07:00
parent 851012d593
commit c271d17e0d
3 changed files with 9 additions and 7 deletions

View File

@ -14,7 +14,7 @@ app.use(function (req, res, next) {
}); });
// Home Route // Home Route
app.get('/', async (req, res) => { app.get('/ua', async (req, res) => {
res.json({ res.json({
message: 'Docker Service :D' message: 'Docker Service :D'
}) })
@ -73,10 +73,10 @@ const readUserAgents = async (req, res) => {
}; };
// เส้นทางสำหรับ create user agent // เส้นทางสำหรับ create user agent
app.post("/user-agents", createUserAgent); app.post("/ua/user-agents", createUserAgent);
// เส้นทางสำหรับ read user agents // เส้นทางสำหรับ read user agents
app.get("/user-agents", readUserAgents); app.get("/ua/user-agents", readUserAgents);
const port = process.env.PORT || 8000 const port = process.env.PORT || 8000

View File

@ -7,7 +7,7 @@ services:
container_name: useragent container_name: useragent
restart: always restart: always
ports: ports:
- 8081:80 - 8085:80
volumes: volumes:
# - ./front/default.conf:/etc/nginx/conf.d/default.conf # - ./front/default.conf:/etc/nginx/conf.d/default.conf
- ./front/html:/usr/share/nginx/html - ./front/html:/usr/share/nginx/html
@ -27,7 +27,7 @@ services:
image: useragent_backend image: useragent_backend
container_name: useragent_backend container_name: useragent_backend
ports: ports:
- 8082:8000 - 8086:8000
depends_on: depends_on:
- useragent_db - useragent_db

View File

@ -66,7 +66,8 @@
} }
console.log(data); console.log(data);
console.log(window.location); console.log(window.location);
fetch("http://192.168.1.108:8082/user-agents", { // fetch("http://192.168.1.108:8086/ua/user-agents", {
fetch("https://ua.klxhub.com/ua/user-agents", {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -76,7 +77,8 @@
.then((response) => response.json()) .then((response) => response.json())
.then((data) => { .then((data) => {
console.log(data); console.log(data);
fetch("http://192.168.1.108:8082/user-agents", { // fetch("http://192.168.1.108:8086/ua/user-agents", {
fetch("https://ua.klxhub.com/ua/user-agents", {
method: "GET", method: "GET",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",