feat: mocked up search form on site
This commit is contained in:
@@ -2,15 +2,24 @@ import http from 'http';
|
||||
import fs from 'fs';
|
||||
import ejs from 'ejs';
|
||||
|
||||
const srcFile = 'src/index.html';
|
||||
const srcFile = 'src/index.ejs';
|
||||
const destFile = 'dist/index.html';
|
||||
|
||||
function build() {
|
||||
const data = {};
|
||||
function getData() {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.readFile('../scraper/db.json', (err, str) => {
|
||||
if (err) reject(err);
|
||||
else resolve(str);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function build() {
|
||||
const data = await getData();
|
||||
const options = {};
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
ejs.renderFile(srcFile, data, options, (err, str) => {
|
||||
ejs.renderFile(srcFile, { data }, options, (err, str) => {
|
||||
if (err) reject(err);
|
||||
else {
|
||||
fs.writeFile(destFile, str, er => {
|
||||
|
||||
Reference in New Issue
Block a user