Skip to content

Commit

Permalink
Merge pull request #8 from FAC29A/alexDatabase
Browse files Browse the repository at this point in the history
Removed database
  • Loading branch information
AlexVOiceover authored Feb 6, 2024
2 parents cb3cef9 + 1b61090 commit b4903e4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 83 deletions.
3 changes: 0 additions & 3 deletions .dockerignore

This file was deleted.

39 changes: 0 additions & 39 deletions Dockerfile

This file was deleted.

27 changes: 0 additions & 27 deletions fly.toml

This file was deleted.

26 changes: 12 additions & 14 deletions src/server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Load environment variables from .env file
require('dotenv').config()

//const model = require('./model/DBFunctions.js')

const express = require('express')
const server = express()

Expand Down Expand Up @@ -99,21 +101,17 @@ server.get('/openEdit/:id', (req, res) => {
}
})

server.post(
'/edit/:id',
express.urlencoded({ extended: false }),
(req, res) => {
const id = req.params.id
const index = posts.findIndex((post) => post.id === id)
if (index !== -1) {
posts[index].message = req.body.message
posts[index].created = Date.now()
res.redirect('/posts')
} else {
res.status(404).send('Post not found')
}
server.post('/edit/:id', express.urlencoded({ extended: false }), (req, res) => {
const id = req.params.id
const index = posts.findIndex((post) => post.id === id)
if (index !== -1) {
posts[index].message = req.body.message
posts[index].created = Date.now()
res.redirect('/posts')
} else {
res.status(404).send('Post not found')
}
)
})

server.get('/back', (req, res) => {
res.redirect('/')
Expand Down

0 comments on commit b4903e4

Please sign in to comment.