...
 
Commits (2)
......@@ -48,7 +48,8 @@ const main = async () => {
app.use(express.static('public'))
// mongodb
const mongo = await MongoClient.connect('mongodb://localhost:27017', {
const mongo_host = process.env.MONGO_HOST || 'mongodb://localhost:27017'
const mongo = await MongoClient.connect(mongo_host, {
useNewUrlParser: true
})
......@@ -71,4 +72,4 @@ const main = async () => {
})
}
main()
\ No newline at end of file
main()
......@@ -289,3 +289,7 @@ pre {
.comment {
color: var(--c-primary);
}
.ul-hover:hover {
text-decoration: underline;
}
......@@ -69,6 +69,7 @@ module.exports = (app, db) => {
const val = req.body[field]
if (!val || val.trim() == '') {
errors.push(sprintf("Field %s is required", field))
return
}
post[field] = val.trim()
......
<main>
<div class="new-post-cta">
<a href="/posts/new">+ Write a new post</a>
<a href="/posts/new" class="ul-hover">+ Write a new post</a>
</div>
{{#each posts}}
<div>
......