Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 690 Bytes

isomorphic-code.md

File metadata and controls

14 lines (10 loc) · 690 Bytes

Isomorphic Code (Universal Code) ~ Sahil

Syncing common folder/files in frontend and backend is a doable solution like that:

Setup directory structure like this:

  • frontend
  • src/isomorphic/types.ts
  • backend
  • utilities/isomorphic/types.ts
  • isomorphic/types.ts

In frontend and backend types.ts file you can add a comment to the top of the file: // This file is autogenerated, DO NOT EDIT THIS FILE INSTEAD EDIT THE SOURCE OF THIS FILE

The common/types.ts can be considered as a source of truth, which is synced whenever the frontend dev server or backend dev server is run via a simple js copy script which copies isomorphic folders each time the development server is updated.