본문 바로가기

IT/web24

Node.js] 구글 패스포트로 사용자 인증 Google Cloud Platform 하나의 계정으로 모든 Google 서비스를 Google Cloud Platform을 사용하려면 로그인하세요. accounts.google.com 여기서 사용자 인증 정보를 만들고 클라이언트 ID, Secret을 발급받는다. 리디렉션 URL 설정 구글 Stragety를 설정. config/passport/google.js var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy; var config = require('../config'); module.exports = function(app, passport) { return new GoogleStrategy({ clientID: config.goo.. 2020. 2. 10.
Node.js] 플래쉬 메시지 connect-flash Flash message middleware for Connect. www.npmjs.com var flash = require('connect-flash'); var app = express(); ... app.use(flash()); 2020. 2. 8.
Node.js] 라우팅 개념 다시 한번 라우팅은 애플리케이션 엔드 포인트(URI)의 정의, 그리고 URI가 클라이언트 요청에 응답하는 방식을 말합니다. Express 라우팅 라우팅 라우팅은 애플리케이션 엔드 포인트(URI)의 정의, 그리고 URI가 클라이언트 요청에 응답하는 방식을 말합니다. 라우팅에 대한 소개는 기본 라우팅을 참조하십시오. 다음 코드는 매우 기본적인 라우트의 예입니다. var express = require('express'); var app = express(); // respond with "hello world" when a GET request is made to the homepage app.get expressjs.com Express 기본 라우팅 기본 라우팅 라우팅은 URI(또는 경로) 및 특정한 HTTP 요청 .. 2020. 2. 8.
Node.js] 사용자 인증 // 패스포트 모듈 use() 함수로스트래티지 (인증방식 ) 설정 후 -> 라우팅 함수에서 사용 인증방식은 로컬 인증, 다른 계정 사용하는 OAuth 인증 등 ㅈ나 많다. Documentation Overview Passport is authentication middleware for Node. It is designed to serve a singular purpose: authenticate requests. When writing modules, encapsulation is a virtue, so Passport delegates all other functionality to the application. This separation o www.passportjs.org var passport = require(.. 2020. 2. 7.