This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Export our app routes | |
exports = module.exports = function (app) { | |
// Set up the default app route to http://localhost:3000/index.html | |
app.get('/index.html', function (req, res) { | |
// Render some simple boilerplate html | |
function renderFullPage() { | |
// Note the div class name here, we will use that as a hook for our React code | |
// We are also adding the bundled javascript code | |
return ` | |
<!doctype html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import ReactDOM from 'react-dom'; | |
const App = () => { | |
return ( | |
<div> | |
<h1> Ramen Noodles </h1> | |
{/* | |
This a random image I made, feel free to skip this in your code | |
If you want to add your own image you can add it to the server/public/img folder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//import keystone | |
var keystone = require('keystone'); | |
// Set up our keystone instance | |
keystone.init({ | |
// The name of the KeystoneJS application | |
'name': 'Keystone CMS', | |
// Paths to our application static files | |
'static': [ | |
'./server/public/js/', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpack = require('webpack'); | |
var path = require('path'); | |
module.exports = { | |
// Since webpack 4 we will need to set in what mode webpack is running | |
mode: 'development', | |
// This will be the entry file for all of our React code | |
entry: [ | |
'./client/index.jsx', | |
], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var keystone = require('keystone'); | |
var Types = keystone.Field.Types; | |
var path = require('path'); | |
// Create a new Keystone list called Recipe | |
var Recipe = new keystone.List('Recipe', { | |
autokey: { path: 'slug', from: 'name', unique: true }, | |
defaultSort: '-createdAt', | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var keystone = require('keystone'); | |
var Types = keystone.Field.Types; | |
var path = require('path'); | |
// Create a new Keystone list called Recipe | |
var Recipe = new keystone.List('Recipe', { | |
autokey: { path: 'slug', from: 'name', unique: true }, | |
defaultSort: '-createdAt', | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var keystone = require('keystone'); | |
var Types = keystone.Field.Types; | |
// First we gonna create our User list | |
var User = new keystone.List('User'); | |
// Then we gonna add the fields | |
User.add({ | |
name: { type: Types.Name, required: true, index: true }, | |
email: { type: Types.Email, initial: true, required: true, index: true }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//import keystone | |
var keystone = require('keystone'); | |
// Set up our keystone instance | |
keystone.init({ | |
// The name of the KeystoneJS application | |
'name': 'Keystone CMS', | |
// Paths to our application static files | |
'static': [], | |
// Keystone includes an updates framework, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//import keystone | |
var keystone = require('keystone'); | |
// Set up our keystone instance | |
keystone.init({ | |
// The name of the KeystoneJS application | |
'name': 'Keystone CMS', | |
// Paths to our application static files | |
'static': [ | |
'./server/public/js/', |
NewerOlder