Coder Social home page Coder Social logo

diary-backend's Introduction

express sever

initial setting

npm init
npm install express --save

npm install @babel/node
npm install @babel/cli
npm install @babel/preset-env
npm install @babel/core
.babelrc

babel plugin 들을 모아놓고 사용할 설정파일

최신문법을 브라우저가 해석 할 수 있게 바꿔주는 작업을 한다.

babel은 plugin이 있는데 각 plugin은 npm 라이브러리를 가지고 있다. 이 라이브러리가 문법을 변환시켜준다

es6 기능을 더 쓰고 싶다면 매번 필요한 plugin을 설치해야하는데 번거로우니 나온 솔루션이 preset이다

{
	"presets" : ["@babel/preset-env"]
}
// package.json
"scripts": {
    "start": "babel-node index.js",
  },
index.js
import express from "express"
nodemon
npm install -g nodemon
// package.json
//delay 2 는 서버가 실행되고 babel이 번역하고 난 후 다시 실행되는것을 방지하기 위해 사용  (서버가 재실행되는것 방지)
"scripts": {
    "start": "nodemon --exec babel-node index.js --dalay 2",
  },

middleware

helmet
//보안 모듈
npm install helmet
morgan
npm install morgan
body-parser
npm install body-parser
passport
npm install passport
cookie-parser
npm install cookie-parser
express-session
npm install express-session

Setting

mongo

  • Terminal
    • apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4 && (echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.0.list) && apt-get update && apt-get install -y mongodb-org && mkdir -p /data/db apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4 && (echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.0.list) && apt-get update && apt-get install -y mongodb-org && mkdir -p /data/db apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4 && (echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/4.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.0.list) && apt-get update && apt-get install -y mongodb-org && mkdir -p /data/db

diary-backend's People

Contributors

flash0211 avatar gorilla-kim avatar scnam123123 avatar

Watchers

James Cloos avatar

Forkers

gorilla-kim

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.