diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..7ea57ee
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,35 @@
+services:
+ app:
+ build:
+ context: .
+ dockerfile: Dockerfile
+ container_name: docker-next
+
+ env_file:
+ - .env
+ ports:
+ - '3000:3000'
+ volumes:
+ - .:/app
+ - /app/node_modules
+ labels:
+ - traefik.enable=true
+ - traefik.docker.network=traefik-public
+ - traefik.constraint-label=traefik-public
+
+ - traefik.http.services.${STACK_NAME?Variable not set}-frontend.loadbalancer.server.port=80
+
+ - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.rule=Host(`${DOMAIN?Variable not set}`) || Host(`www.${DOMAIN?Variable not set}`)
+ - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.entrypoints=http
+
+ - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-https.rule=Host(`${DOMAIN?Variable not set}`) || Host(`www.${DOMAIN?Variable not set}`)
+ - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-https.entrypoints=https
+ - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-https.tls=true
+ - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-https.tls.certresolver=le
+
+ # Enable www redirection for HTTP and HTTPS
+ - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-https.middlewares=${STACK_NAME?Variable not set}-www-redirect
+ - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.middlewares=https-redirect,${STACK_NAME?Variable not set}-www-redirect
+ networks:
+ - traefik-public
+ - default
\ No newline at end of file
diff --git a/favicon.ico b/favicon.ico
new file mode 100644
index 0000000..c2a2a04
Binary files /dev/null and b/favicon.ico differ
diff --git a/public/favicon.ico b/public/favicon.ico
new file mode 100644
index 0000000..c2a2a04
Binary files /dev/null and b/public/favicon.ico differ
diff --git a/utils/index.ts b/utils/index.ts
index 166146d..ae353d3 100644
--- a/utils/index.ts
+++ b/utils/index.ts
@@ -11,7 +11,7 @@ export async function postMessage(data: MessageProps) {
};
const body = JSON.stringify(data);
- const url = `http://localhost/api/v1/messages/`;
+ const url = `${process.env.NEXT_PUBLIC_API_URL}messages/`;
try {
const response = await fetch(url, {
@@ -41,7 +41,7 @@ export async function fetchAboutus() {
const headers: HeadersInit = {
accept: "application/json"
};
- const url = `${process.env.api_url}aboutUs`;
+ const url = `${process.env.NEXT_PUBLIC_API_URL}aboutUs/`;
console.log('Fetching from URL:', url);
try {
const response = await fetch(url, { headers });
@@ -67,7 +67,7 @@ export async function fetchCourses() {
accept: "application/json"
};
- const url = `${process.env.api_url}course/?skip=0&limit=100`;
+ const url = `${process.env.NEXT_PUBLIC_API_URL}course/?skip=0&limit=100`;
console.log('Fetching from URL:', url);
try {
@@ -83,7 +83,11 @@ export async function fetchCourses() {
info_images: course?.info_images?.sort((a: any, b: any) => a.index - b.index),
}));
- return coursesArray;
+ const sortedCoursesArray = coursesArray.sort((a, b) =>
+ new Date(a.created_at).getTime() - new Date(b.created_at).getTime()
+ );
+
+ return sortedCoursesArray;
} catch (error) {
console.error('Fetch error:', error);
throw error;
@@ -95,7 +99,7 @@ export async function fetchCourse(id: string) {
accept: "application/json"
};
- const url = `${process.env.api_url}course/${id}`;
+ const url = `${process.env.NEXT_PUBLIC_API_URL}course/${id}/`;
console.log('Fetching from URL:', url);
try {
@@ -120,7 +124,7 @@ export async function fetchSettings() {
const headers: HeadersInit = {
accept: "application/json"
};
- const url = `${process.env.api_url}setting`;
+ const url = `${process.env.NEXT_PUBLIC_API_URL}setting/`;
console.log('Fetching from URL:', url);
try {
const response = await fetch(url, { headers });