본문 바로가기

IT

Node.js와 Browser 에서 실행되는 JS 파일을 공유하고 싶을 때

https://caolan.uk/articles/writing-for-node-and-the-browser/

 

Writing for node and the browser

Modules that can be used both on the server and the client-side are a useful way to reuse code. This is one way of writing a module that will work well with both systems, while allowing you to write code in the familiar node style. In node you use module.e

caolan.uk

 

https://stackoverflow.com/questions/3225251/how-can-i-share-code-between-node-js-and-the-browser

 

How can I share code between Node.js and the browser?

I am creating a small application with a JavaScript client (run in the browser) and a Node.js server, communicating using WebSocket. I would like to share code between the client and the server. I...

stackoverflow.com

 

 

node와 브라우저에서 실행되는 js파일을 서로 공유하고 싶을때,

주로 공통 기능또는 자료구조 등이 명시된 코드 뭉치를 포함하는 js 파일이 될 것 인데

위 링크를 확인하면 구체적인 방법을 확일 할 수 있다.