memostack
article thumbnail
apollo server와 knex를 이용하여 postgresql 연동하기 (with monorepo, typescript)
Backend/GraphQL 2022. 8. 26. 21:24

환경 nodejs: v16.15.1 (lts) yarn version: berry 프로젝트 구조: monorepo Framework: apollo-server-express 기타 사용 모듈: typescript, Knex DB: postgresql monorepo 프로젝트 생성 graphql 서버 구축 전에 yarn workspace를 활용하여 monorepo 프로젝트 생성을 한다. mkdir knex-apollo-server-example yarn berry를 사용하기 위해 버전을 변경한다. 그리고 yarn init 명령어로 프로젝트 초기 설정을 한다. yarn set version berry yarn init -y .yarnrc.yml에서 nodeLinker에 node-modules를 추가한다. no..

article thumbnail
express 설치부터 기본 사용법
Frontend/Express 2021. 7. 20. 23:13

express 설치 npm 또는 yarn을 이용하여 express 를 설치한다. 본 글에서는 yarn을 사용 $ yarn add express npm을 사용할 경우 npm install --save express 명령어를 수행한다. hello world 출력 아래와 같이 server.js 파일을 생성 const express = require("express"); const app = express(); const port = 3000; // port 번호 설정 app.get("/", (req, res) => { res.send("Hello World"); }); app.listen(port, () => { console.log(`Example app listening at http://localhost..