Commit c120d6b9 authored by Corbin Crutchley's avatar Corbin Crutchley Committed by Tim Neutkens

Fastify example dep update (#6714)

This merge request updates `fastify` package from v1 to v2 and adds the `cross-env` package so `NODE_ENV=` can work on Windows as well as OSX/Linux. Also adds example build output to GITIGNORE

Worth mentioning that pressing `a` will bring up a page that says `b` and vice-versa, but this seems to be the logic from the previous example as well. Can change if wanted
parent c97617fd
...@@ -2,14 +2,17 @@ ...@@ -2,14 +2,17 @@
"name": "custom-server-fastify", "name": "custom-server-fastify",
"version": "1.0.0", "version": "1.0.0",
"scripts": { "scripts": {
"dev": "node server.js", "dev": "node ./server.js",
"build": "next build", "build": "next build",
"start": "NODE_ENV=production node server.js" "start": "cross-env NODE_ENV=production node ./server.js"
}, },
"dependencies": { "dependencies": {
"fastify": "1.8.0", "fastify": "2.1.0",
"next": "latest", "next": "latest",
"react": "^16.7.0", "react": "^16.8.4",
"react-dom": "^16.7.0" "react-dom": "^16.8.4"
},
"devDependencies": {
"cross-env": "^5.2.0"
} }
} }
import { applySnapshot, Instance, SnapshotIn, SnapshotOut, types } from "mobx-state-tree"; import { applySnapshot, Instance, SnapshotIn, SnapshotOut, types } from "mobx-state-tree";
let store:IStore = null as any; let store: IStore = null as any;
const Store = types const Store = types
.model({ .model({
...@@ -35,10 +35,10 @@ export type IStoreSnapshotOut = SnapshotOut<typeof Store>; ...@@ -35,10 +35,10 @@ export type IStoreSnapshotOut = SnapshotOut<typeof Store>;
export const initializeStore = (isServer, snapshot = null) => { export const initializeStore = (isServer, snapshot = null) => {
if (isServer) { if (isServer) {
store = Store.create({ foo:6, lastUpdate: Date.now() }); store = Store.create({ foo: 6, lastUpdate: Date.now() });
} }
if (store as any === null) { if (store as any === null) {
store = Store.create({ foo:6, lastUpdate: Date.now() }); store = Store.create({ foo: 6, lastUpdate: Date.now() });
} }
if (snapshot) { if (snapshot) {
applySnapshot(store, snapshot); applySnapshot(store, snapshot);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment