목록전체 글 (21)
BugDIARY
▶Middleware사용하기 middleware는 요청과 서버 사이에서 실행하는 것을 말합니다. 미들웨어는 변수로서 request, response, next를 받을 수 있습니다. (가지고 있음) const middlewareHome = (req, res, next) => { console.log("middleWare View"); next(); } app.get("/", middlewareHome, handleHome); 간단히 Middleware를 확인할 수 있는 함수입니다. ① middlewareHome이라는 함수는 request, response, next라는 변수를 가지고 있으며 ② 이 변수에 값을 받게 되면 안의 console.log를 실행한 뒤 ③ next()를 반환시켜줍니다. ※ 현재의 미..
babel이란 대상 환경에 필요한 구문 변환 (및 선택적으로 브라우저)를 세부적으로 관리 할 필요없이 최신 JavaScript를 사용할 수있는 스마트 사전 설정입니다. babel을 설치함으로서 최신 JS코드를 작성할 수 있게 됩니다. 지금은 node에서 사용하는 babel을 설치하여야 하므로 아래와 같이 입력합니다. ▶ 설치 방법 npm install @babel/node PS [대상 프로젝트]> npm install babel npm WARN deprecated babel@6.23.0: In 6.x, the babel package has been deprecated in favor of babel-cli. Check https://opencollective.com/babel to support the..
○ Express를 설치하고 싶은 폴더 안에서 아래와 같은 커맨드 입력 npm install express PS [프로젝트경로]> npm install express npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN enoent ENOENT: no such file or directory, open '[프로젝트경로]\package.json' npm WARN PublicRecipe No description npm WARN PublicRecipe No repository field. npm WARN PublicRecipe No README data npm WARN PublicRecipe No li..
app.js import "core-js"; import express from "express"; import morgan from "morgan"; import helmet from "helmet"; import cookieParser from "cookie-parser"; import bodyParser from "body-parser"; const app = express(); app.use(cookieParser()); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: true})); app.use(helmet()); app.use(morgan("dev")); export default app; - nodejs의 경우, e..
APP 디렉토리 애플리케이션의 핵심 코드가 들어 있는 디렉토리. 컴포저에 의해 App이라는 네임스페이스를 통해서 오토로딩된다. 하지만, 실제 애플리케이션의 로직이 포함되어 있지 않으며 단순히 애플리케이션에 명령을 보내기 위한 디렉토리이다. APP의 추가 디렉토리 - Console : 모든 *아티즌들의 명령어를 포함. - Exceptions - Http : Controller 와 middleware, requests를 가지고 있다. - Providers 또한, make 아티즌명령어를 통하여 언제든지 다양한 디렉토리를 생성할 수 있다. ex) make:job 실행 ->App디렉토리의 하위로 job디렉토리 추가 * 아티즌이란 : 아티즌(Artisan)은 라라벨에 포함된 커맨드라인 인터페이스(CLI)의 이름이며..