Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save youtube-jocoding/c564f1ad4c08aa12cbfd0f42e090c8ba to your computer and use it in GitHub Desktop.
Save youtube-jocoding/c564f1ad4c08aa12cbfd0f42e090c8ba to your computer and use it in GitHub Desktop.
@nicedanny
Copy link

nicedanny commented Mar 12, 2024

책을 구매해서 접속했는데요, 파일을 다운로드가 되면 압축파일 안에 아무것도 없어요..

@MacTechIN
Copy link

책을 구매해서 접속했는데요, 파일을 다운로드가 되면 압축파일 안에 아무것도 없어요..

네 맞습니다. 구글 드라이브에서 압축파일을 받으면 404KB 인데 열면 아무것도 없습니다. 확인 부탁드립니다.

@youtube-jocoding
Copy link
Author

@nicedanny @MacTechIN 코드는 정상적으로 있는데 아마 보안 프로그램 때문에 코드를 다운 받아서 자동 삭제 처리가 되었을 것 같습니다.
Github에도 별도로 올려두었으니 아래 주소에서 확인해보세요!
https://github.com/youtube-jocoding/chatgpt-api-chatdoge-book

@MacTechIN
Copy link

MacTechIN commented Mar 25, 2024 via email

Copy link

ghost commented Aug 1, 2024

Cannot GET / 이라고 뜨는데 왜일까요

Copy link

ghost commented Aug 1, 2024

코드 ctrl + c, ctrl + v 했는데 안되네요 ㅠㅠ

@BurningDroid
Copy link

배포까지 했는데요.
다음과 같이 에러 로그 뜨면서 안되네요 ;;

https://chatdoge-yoonhok.pages.dev' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

backend 코드는 다음과 같고요.
제가 뭘 놓친 걸까요...?
책에 나온대로 한다고 한 것 같은데요 ㅠㅠ

require('dotenv').config();

const OpenAI = require('openai');
const client = new OpenAI({
    apiKey: process.env.API_KEY_OPENAI
});

const serverless = require('serverless-http')

const express = require('express');
const app = express();

const cors = require('cors');
const corsOptions = {
    origin: 'https://chatdoge-yoonhok.pages.dev',
    credentials: true
}
app.use(cors(corsOptions))
app.use(express.json())
app.use(express.urlencoded({ extended: true }))

app.post('/fortuneTell', async function (req, res) {
    ...
})

module.exports.handler = serverless(app)

@BurningDroid
Copy link

람다 배포 관련해서 무슨 API Gateway 설정 같은 걸 해야 하는 것 같은데요.
이게 누락되서 그런 건가요...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment