Skip to content
Permalink
Browse files
update source code
  • Loading branch information
edebiria committed May 15, 2019
1 parent 151f8c5 commit ecf8904104533519b3694f29177ea566666a267f
Showing 1 changed file with 9 additions and 3 deletions.
@@ -98,7 +98,7 @@ router.get('/login', async ctx => {
const data = {}
if(ctx.query.msg) data.msg = ctx.query.msg
if(ctx.query.user) data.user = ctx.query.user
await ctx.render('login', data)
await ctx.render('login', data)
})

router.post('/login', async ctx => {
@@ -132,6 +132,12 @@ router.post('/login', async ctx => {
// }
// })

router.get('/review', async ctx => await ctx.render('review'))

router.get('/Display', async ctx => await ctx.render('Display'))

router.get('/admin', async ctx => await ctx.render('admin'))

router.get('/logout', async ctx => {
ctx.session.authorised = null;
ctx.redirect('/')
@@ -141,7 +147,7 @@ app.use(router.routes())
module.exports = app.listen(port, async() => {
// MAKE SURE WE HAVE A DATABASE WITH THE CORRECT SCHEMA
const db = await sqlite.open('./website.db')
await db.run('CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY AUTOINCREMENT, user TEXT, pass TEXT);')
await db.run('CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY AUTOINCREMENT, user TEXT, pass TEXT, admin INT DEFAULT 0);')
await db.close()
console.log(`listening on port ${port}`)
})
})

0 comments on commit ecf8904

Please sign in to comment.