1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-10 11:24:35 +00:00

feat: add views and styles for rendering html

This commit is contained in:
2021-10-07 17:22:00 +00:00
parent bd92b8b983
commit a446f5c4f7
4 changed files with 33 additions and 2 deletions

0
public/styles.css Normal file
View File

View File

@@ -1,5 +1,10 @@
import express from 'express'
import { processSas, createFileTree, getTreeExample } from '../controllers'
import {
processSas,
createFileTree,
getTreeExample,
sasjsExecutor
} from '../controllers'
import { ExecutionResult, isRequestQuery, isFileTree } from '../types'
const router = express.Router()
@@ -50,7 +55,10 @@ router.post('/deploy', async (req, res) => {
// TODO: respond with HTML page including file tree
router.get('/SASjsExecutor', async (req, res) => {
res.status(200).send({ status: 'success', tree: {} })
const tree = sasjsExecutor()
// res.status(200).send({ status: 'success', tree })
console.log(tree)
res.render('index', { tree })
})
router.get('/SASjsExecutor/do', async (req, res) => {

10
src/views/index.pug Normal file
View File

@@ -0,0 +1,10 @@
extends layout
block layout-content
div
h1 SASJS Executor
div
ul
li= tree.name
each item in tree.children
li= item.name

13
src/views/layout.pug Normal file
View File

@@ -0,0 +1,13 @@
block variables
doctype html
html
head
meta(charset="utf-8")
meta(name="viewport", content="width=device-width, initial-scale=1, shrink-to-fit=no")
meta(name="theme-color", content="#000000")
link(rel="shortcut icon", href="/favicon.ico")
link(rel="stylesheet" href="/styles.css")
title SASJS Executor
body
div#root
block layout-content