Skip to content

Commit 2da70ce

Browse files
committed
Limit max stories, make story body optional
1 parent b430b43 commit 2da70ce

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ version: '3'
22
services:
33
api-server:
44
build: ./
5+
entrypoint: [ "npm", "run", "dev" ]
56
env_file: ./config/config.env
67
ports:
78
- '3000:3000'
89
networks:
910
- storybooks-app
11+
volumes:
12+
- ./:/usr/src/app
13+
- /usr/src/app/node_modules
1014
depends_on:
1115
- mongo
1216
mongo:

models/Story.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const StorySchema = new mongoose.Schema({
88
},
99
body: {
1010
type: String,
11-
required: true,
11+
required: false,
1212
},
1313
status: {
1414
type: String,

routes/stories.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ router.get('/', ensureAuth, async (req, res) => {
3030
const stories = await Story.find({ status: 'public' })
3131
.populate('user')
3232
.sort({ createdAt: 'desc' })
33+
.limit(18)
3334
.lean()
3435

3536
res.render('stories/index', {

views/stories/index.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h1>Stories</h1>
1+
<h1>Latest Stories</h1>
22
<div class="row">
33
{{#each stories}}
44
<div class="col s12 m4">

0 commit comments

Comments
 (0)