1. nav.ejs
<nav class="navbar navbar-expand-sm navbar-light bg-light">
<a class="navbar-brand" href="#">ToDoApp</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item <%if(active=='home'){%>active<%}%> ">
<a class="nav-link" href="/">Home<span class="sr-only">(current)</span></a>
</li>
<li class="nav-item <%if(active=='write'){%>active<%}%> ">
<a class="nav-link" href="/write">Write</a>
</li>
<li class="nav-item <%if(active=='list'){%>active<%}%> ">
<a class="nav-link" href="/list">List</a>
</li>
<li class="nav-item <%if(active=='login'){%>active<%}%> ">
<a class="nav-link" href="/login">Login</a>
</li>
<li class="nav-item <%if(active=='mypage'){%>active<%}%> ">
<a class="nav-link" href="/mypage">MyPage</a>
</li>
</ul>
</div>
</nav>
2. 다른 ejs에서 반복 사용
//login.ejs에서
<%- include('nav.ejs', {active:'login'}) %>
//list.ejs에서
<%- include('nav.ejs', {active:'list'}) %>
3. nav.ejs에서 data 사용
<li class="nav-item <%if(active=='list'){%>active<%}%> ">
<a class="nav-link" href="/list">List</a>
</li>
<li class="nav-item <%if(active=='login'){%>active<%}%> ">
<a class="nav-link" href="/login">Login</a>
</li>