1.Create a page: Create a new HTML file in the public/html directory
2.Set route: Create a new JS file in the routes directory, The file content is the following
'use strict';
// Import Basic Dependencies
import { log } from 'console';
import getView from './getView.js';
import { createReadStream } from 'fs';
import { join } from 'path';
import Kr from 'koa-router';
// Initialize Koa-Router Instance
const Krs = new Kr;
// Create Couter Path
Krs.get('/View file name', async socket => {
socket.status = 200;
socket.type = 'text/html';
socket.body = await getView('View file name');
});
// Export Router
export default Krs.routes();
3.Binding server: Open src/koaServer.js file, add the following
import View file name from '../routes/View file name.js';
webServer.use(View file name);