you-space / dashboard

Admin dashboard of you-space
0 stars 0 forks source link

You-space bridge #3

Closed zzhenryquezz closed 2 years ago

zzhenryquezz commented 2 years ago

Because the dashboard is a project separated of you-space it will need a bridge between they.

It will work as the themes, it will get a filename and then return the string. Ex:

async function render({ url, response }) {
  if (url === '/') {
   return fs.promises.readFile(path.resolve(__dirname, 'dist',  'index.html'))
  }

 if (url === '/main.js') {
   return fs.promises.readFile(path.resolve(__dirname, 'dist',  'main.,js'))
  }
}

In you-space

import Route from '@ioc:Adonis/Core/Route'
import Dashboard from '@you-space/dashboard'

Route.get('/ys-admin/*',  Dashboard.render)

Outcome