반응형
express 설치
npm i express-generator -g
express 프로젝트 생성
-e 옵션은 ejs를 사용하겠다는 뜻
express -e 프로젝트명
프로젝트로 이동 후 npm(Node Package Manager) & boorstrap 설치
npm i && npm i bootstrap --save
app.js 파일을 연 후, bootstrap 경로 추가
app.use('/bootstrap', express.static(path.join(__dirname,"node_modules/bootstrap/dist")));
views/index.ejs 파일을 다음 내용으로 변경
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="http://bootstrapk.com/favicon.ico">
<title>Cover Template for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="http://bootstrapk.com/examples/cover/cover.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="../../bootstrap/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="/bootstrap/js/ie-emulation-modes-warning.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="site-wrapper">
<div class="site-wrapper-inner">
<div class="cover-container">
<div class="masthead clearfix">
<div class="inner">
<h3 class="masthead-brand">Cover</h3>
<nav>
<ul class="nav masthead-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Features</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</div>
</div>
<div class="inner cover">
<h1 class="cover-heading">Cover your page.</h1>
<p class="lead">Cover is a one-page template for building simple and beautiful home pages. Download, edit the text, and add your own fullscreen background photo to make it your own.</p>
<p class="lead">
<a href="#" class="btn btn-lg btn-default">Learn more</a>
</p>
</div>
<div class="mastfoot">
<div class="inner">
<p>Cover template for <a href="http://getbootstrap.com">Bootstrap</a>, by <a href="https://twitter.com/mdo">@mdo</a>.</p>
</div>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="/bootstrap/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="/bootstrap/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>
npm start로 서버 실행 후 확인
Node에 Bootstrap이 잘 적용됨.
반응형
'개발 > Node.Js' 카테고리의 다른 글
카페24 nodejs 가입부터 git 배포까지 총정리 (0) | 2022.11.08 |
---|---|
PSSecurityException 스크립트 보안 오류 해결 방법 (0) | 2022.10.29 |
Nodejs 이메일 전송 구현(Nodemailer) (0) | 2021.01.01 |
Node 자동재시작 Supervisor 설치 (0) | 2020.12.31 |
Node / Vue 현재시간 구하기 (0) | 2020.10.28 |
댓글