Key Topics

Develop Admin Dashboard and Access Database

Development Summary


Introduction to EJS

EJS stands for Embedded Javascript. It is a simple templating language that embeds Javascript code directly into HTML and provides a way to dynamically generate HTML content on the server side.

EJS template

*<%= …. %>*  outputs the result of Javascript expressions

<!DOCTYPE html>
<html lang="en">
<head> </head>
<body>
    <h1><%= message %></h1>
</body>
</html>

Rendering HTML With Data from Database

Install and Import Library

Like the survey form that we have created, we need to install libraries and import the following modules.

const express = require("express");
const app = express();
const cors = require("cors");
const bodyParser = require("body-parser");
const mysql = require("mysql2"); // mysql 모듈 사용
const path = require("path");