This repository contains example content that we use in our book. Copy this repo when instructed while reading the book.
demo-book's Introduction
demo-book's People
Forkers
cnadav wilvk earllee alexloof aydeke test-saonho bimah claeszombie 410dood nmalancea johnking allenlili vbsaba1992 flyntrudolph abrambueno1992 manotluijiu percypham maelstroms38 jasonsprouse slkjer carrie8shine jimmyma eyanus-lin davidleroymcintyre kstar0929 noodles007 drewpager jkim19 tdarcusintern igigi ryanyogan wooodhead jasonsubba267 warpgap jonathangrossman shunyaorad poinx71 splitwisemb md1116 jcortes0309 choopk jprzybylko googlicius delgermurun stanwmusic lolo266 taishi8117 mrhanson3 jiayangwu ailec0623 doppelgunner allanice001 wozboz daisycrego ygleitclevalign makisang omb-vn vsrn09 onreadystatechange benevolentyz wrone tima101 alanphanth abay-ongar-botabek reingoldkz irwangunardi polynn nsalow32 njosten99 cortehz batamardemo-book's Issues
[ Question ] Rendering Chapters
Windows 10 Professional
MongoDB.Atlas
Node v8.10.0
All dependencies for Windows have been installed. When I synced Github in Ch. 6 the introduction page md was synced to MongoDB but none of the other demo-book info synced. Now in Ch. 8 the stripe buy button requires the chapter-1.md to test the integration and I'm hung up on rendering anything other than the introduction page. I've signed back in as the Admin and resynced but the alert tells me nothing has changed in the document. I've narrowed down this issue and know of a solution that could be implemented. It is a bit DRY, similar to the pattern shown here, https://www.khanacademy.org/computer-programming/spin-off-of-project-magic-8-ball/6639567377956864. Outside of explicitly stating each path, is there any other implementation other than :
static async syncContent({ book, data }) {
const {
title,
excerpt = '',
isFree = false,
seoTitle = '',
seoDescription = '',
} = data.attributes;
const { body, path } = data;
const chapter = await this.findOne({
bookId: book.id,
githubFilePath: path,
});
let order;
if (path === 'introduction.md') {
order = 1;
} else {
order = parseInt(path.match(/[0-9]+/), 10) + 1;
}
const content = body;
const htmlContent = markdownToHtml(content);
const htmlExcerpt = markdownToHtml(excerpt);
const sections = getSections(content);
if (!chapter) {
const slug = await generateSlug(this, title, { bookId: book._id });
return this.create({
bookId: book._id,
githubFilePath: path,
title,
slug,
isFree,
content,
htmlContent,
sections,
excerpt,
htmlExcerpt,
order,
seoTitle,
seoDescription,
createdAt: new Date(),
});
}
const modifier = {
content,
htmlContent,
sections,
excerpt,
htmlExcerpt,
isFree,
order,
seoTitle,
seoDescription,
};
if (title !== chapter.title) {
modifier.title = title;
modifier.slug = await generateSlug(this, title, {
bookId: chapter.bookId,
});
}
return this.updateOne({ _id: chapter._id }, { $set: modifier });
}
}
in the Mongoose Chapter model you might suggest to sync data between MongoDB and Github?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.