forked from qwik/qwik-site
Can now handle gitea events.
This commit is contained in:
parent
a22c8a4d2a
commit
73d8228c62
13
index.js
13
index.js
|
@ -1,11 +1,13 @@
|
|||
import fs from 'fs'
|
||||
import express from 'express'
|
||||
import { exec } from 'child_process'
|
||||
|
||||
import express from 'express'
|
||||
import njk from 'nunjucks'
|
||||
|
||||
import { requestHandler } from './libs/requestHandler.js'
|
||||
import { utils } from './libs/utils/utils.js'
|
||||
import { nunjacksConfig } from './libs/nunjucksConfig.js'
|
||||
import { generateSiteMap } from './libs/utils/siteMap.js'
|
||||
|
||||
|
||||
// Load in config
|
||||
|
@ -33,6 +35,15 @@ utils.generate()
|
|||
// Send all requests to the requestHandler.
|
||||
Server.get('*', (req, res) => requestHandler(req, res, Config))
|
||||
|
||||
// Handle events from gitea.
|
||||
Server.post('/gitea/pushEvent', (req, res) => {
|
||||
console.log("Received gitea push event; pulling from gitea and regenerating site map...")
|
||||
exec("git pull")
|
||||
generateSiteMap(Config)
|
||||
res.status(200).send('OK!')
|
||||
console.log("Done!")
|
||||
})
|
||||
|
||||
|
||||
|
||||
// Start the server
|
||||
|
|
Loading…
Reference in New Issue
Block a user