parent
0a97c59169
commit
55b0b1235f
@ -0,0 +1,8 @@
|
|||||||
|
##### FRONT END #####
|
||||||
|
git clone git@ssh.dev.azure.com:v3/HackKu/HackKu%202020/frontend frontend
|
||||||
|
cd frontend
|
||||||
|
npm i
|
||||||
|
ionic build --prod
|
||||||
|
tar czvf target-www.tar.gz ./www
|
||||||
|
|
||||||
|
##### target-www.tar.gz is the artifact! #####
|
@ -0,0 +1,40 @@
|
|||||||
|
const Unit = require('libflitter/Unit')
|
||||||
|
const cors = require('cors')
|
||||||
|
const Express = require('express')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
class IonicUnit extends Unit {
|
||||||
|
static get services() {
|
||||||
|
return [...super.services, 'configs', 'express', 'canon', 'utility']
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(...args) {
|
||||||
|
super(...args)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fully qualified path to the root of the ionic app.
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
this.directory = path.resolve(path.dirname(this.utility.root()), this.configs.get('ionic.root'))
|
||||||
|
}
|
||||||
|
|
||||||
|
async go(app) {
|
||||||
|
app.express.use(cors())
|
||||||
|
|
||||||
|
app.express.use('/i', [
|
||||||
|
this.canon.get('middleware::auth:UserOnly'),
|
||||||
|
(req, res, next) => {
|
||||||
|
const allowed_extensions = ['.html', '.js', '.css', '.svg', '.ttf', '.jpg', '.png', '.jpeg']
|
||||||
|
for ( const k1 in allowed_extensions ) {
|
||||||
|
if ( req.path.endsWith(allowed_extensions[k1]) ) return next()
|
||||||
|
}
|
||||||
|
|
||||||
|
return res.sendFile(path.resolve(this.directory, 'index.html'))
|
||||||
|
},
|
||||||
|
Express.static(this.directory),
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = exports = IonicUnit
|
@ -0,0 +1,9 @@
|
|||||||
|
// ionic Configuration
|
||||||
|
const ionic = {
|
||||||
|
|
||||||
|
// Path to the root of the ionic app from the root of the Flitter app
|
||||||
|
root: 'www',
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = exports = ionic
|
@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Missing Frontend</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>You have not deployed the front-end to this application.</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in new issue