소개
게시글
질문&답변
2024.02.06
강좌의 샘플 프로젝트 파일을 올려주시면 좋을 것 같아요.
강의 링크는 확인하였습니다. 감사합니다.공유주신 내용으로 해도 안되네요;> npm i typescript -g > npm run start ... TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for ... code: 'ERR_UNKNOWN_FILE_EXTENSION' } [nodemon] app crashed - waiting for file changes before starting...
- 0
- 2
- 396
질문&답변
2024.02.04
강좌의 샘플 프로젝트 파일을 올려주시면 좋을 것 같아요.
package.json { "name": "sample", "version": "1.0.0", "description": "", "main": "main.ts", "type":"module", "scripts": { "start:build":"tsc -w --project tsconfig.json && npx -p tsconfig.json", "build:live":"nodemon --watch 'src/**/*' --exec ts-node --esm src/main.ts --verbose", "start":"npm run build:live" }, "author": "", "license": "ISC", "dependencies": { "fastify": "^4.26.0" }, "devDependencies": { "@types/node": "^20.11.16", "nodemon": "^3.0.3", "ts-node": "^10.9.2", "typescript": "^5.3.3" } } tsconfig.json{ "compilerOptions": { "module": "ES2022", /* Specify what module code is generated. */ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ "target": "ES2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ "moduleResolution": "Node", /* Specify how TypeScript looks up a file from a given module specifier. */ "outDir": "./dist", /* Specify an output folder for all emitted files. */ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ "strict": true, /* Enable all strict type-checking options. */ "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ "inlineSourceMap": true /* Include sourcemap files inside the emitted JavaScript. */ }, "include": [ "src/**/*" ], "exclude": [ "document", "backup" ], "ts-node":{ "esm":true, "experimentalSpecifierResolution":"node" } } npm start [nodemon] 3.0.3 [nodemon] to restart at any time, enter `rs` [nodemon] or send SIGHUP to 45444 to restart [nodemon] watching path(s): 'src\**\*' [nodemon] watching extensions: ts,json [nodemon] starting `ts-node --esm src/main.ts` [nodemon] spawning [nodemon] child pid: 39804 [nodemon] watching 5 files TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" ..
- 0
- 2
- 396
질문&답변
2022.07.01
Resolver 순환참조 관련 건
감사합니다. 외부에서 받아서 사용자 정보를 받아아서 사용자 정보를 셋팅하는데 사용하려고 합니다. @Component public class LoginUserArgumentResolver implements HandlerMethodArgumentResolver { final static Logger logger = LoggerFactory.getLogger(LoginUserArgumentResolver.class); private final AuthService authService; public LoginUserArgumentResolver(@Lazy AuthService authService) { this.authService = authService; } @Override public boolean supportsParameter(MethodParameter methodParameter) { if (methodParameter.hasParameterAnnotation(LoginUser.class)) { return true; } return false; } @Override public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { HttpServletRequest request = (HttpServletRequest) webRequest.getNativeRequest(); UserResponse response = getUserInfo(request); return UserInfo.builder() .clientIp(response.getClientIp()) .getUserId(response.getUserId()) .build(); } private UserResponse getUserInfo(HttpServletRequest request) { val name = WebUtils.getCookie(request, "_nest"); if (name == null) throw new UserDefineException(ExEnum.ACCESS_DENIED_EXCEPTION); val _nest = name.getValue(); logger.info("Cookie : " + _nest); val clientIp = ClientIP.getIp(request); val userInfo = authService.checkSession(_nest, clientIp); if (userInfo == null || !userInfo.getIsLogin()) throw new UserDefineException(ExEnum.ACCESS_DENIED_EXCEPTION); return userInfo; } } @Service @RequiredArgsConstructor public class AuthService { @Value("${sso.url}") private String url; //call external api (FeignClient module) private final AuthClient authClient; public UserResponse checkSession(String userCookie, String clientIP) { Map headers = new HashMap(); headers.put("Authorization", "Basic " + createBasicAuthorize(url)); return AuthClient.checkSession(headers, userCookie, clientIP); } private String createBasicAuthorize(String plainCreds) { byte[] plainCredsBytes = plainCreds.getBytes(); byte[] base64CredsBytes = Base64.encodeBase64(plainCredsBytes); return new String(base64CredsBytes); } }
- 0
- 3
- 264
질문&답변
2022.06.14
동적 table naming 관련 건
해당 부분 해결하였습니다! em.createNativeQuery
- 0
- 2
- 1.3K