Skip to content

Commit

Permalink
Limit max stories, make story body optional
Browse files Browse the repository at this point in the history
  • Loading branch information
sidpalas committed Nov 3, 2020
1 parent b430b43 commit 2da70ce
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ version: '3'
services:
api-server:
build: ./
entrypoint: [ "npm", "run", "dev" ]
env_file: ./config/config.env
ports:
- '3000:3000'
networks:
- storybooks-app
volumes:
- ./:/usr/src/app
- /usr/src/app/node_modules
depends_on:
- mongo
mongo:
Expand Down
2 changes: 1 addition & 1 deletion models/Story.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const StorySchema = new mongoose.Schema({
},
body: {
type: String,
required: true,
required: false,
},
status: {
type: String,
Expand Down
1 change: 1 addition & 0 deletions routes/stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ router.get('/', ensureAuth, async (req, res) => {
const stories = await Story.find({ status: 'public' })
.populate('user')
.sort({ createdAt: 'desc' })
.limit(18)
.lean()

res.render('stories/index', {
Expand Down
2 changes: 1 addition & 1 deletion views/stories/index.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1>Stories</h1>
<h1>Latest Stories</h1>
<div class="row">
{{#each stories}}
<div class="col s12 m4">
Expand Down

0 comments on commit 2da70ce

Please sign in to comment.