Skip to content

Instantly share code, notes, and snippets.

// 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>
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
//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/',
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',
],
@Colour-Full
Colour-Full / Recipe.js
Created March 4, 2018 13:02
Keystone Js with React and Redux
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',
});
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',
});
@Colour-Full
Colour-Full / users.js
Created March 4, 2018 13:00
Keystone Js with React and Redux
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 },
@Colour-Full
Colour-Full / index.js
Last active March 11, 2018 19:35
Keystone Js with React and Redux
//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,
//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/',