Share sourse code nodejs đang phát triển
-
Chào các bạn,
Mình tham gia diễn đàn cũng được 1 thời gian, sau một thời gian nghiên cứu, trên tinh thần cùng nghiên cứu phát triển, mình xin chia sẽ sourse code đang phát triển cho anh em nào cần. Do cũng mới làm quen nên chưa còn nhiều chỗ chưa hiểu rõ, nay mình chia sẽ để các bạn mới học nodejs tham khảo (pro thì xem chơi cho vui thôi)
Link: http://www.mediafire.com/file/fcs0eq9x1wrjme3/node_cms.zip- Các bạn dowload sourse về, giải nén, tạo cơ sở dữ liệu "node_cms_database" export cở sở dữ liệu trong thư mục database (mongodb).
(tham khảo cách import dữ liệu mongodb tại đây : http://o7planning.org/vi/10279/import-va-export-co-so-du-lieu-mongodb) - Chạy câu lệnh nodemon để start server
Các mục cần chú ý:
- Route chứa các điều hướng đến controller
- Controller trong thư mục "controller"
- Model trong thư mục "model"
- Views trong thư mục "views"
- Kết nối mongodb bằng robomongo, tìm đến colection "administrator" -> Đổi "ad_user" thành user name login
- Đăng nhập quản trị bằng link: localhost:8000/login.html, mình đang code trong admin.
=> Hy vọng sẽ giúp ích cho các bạn mới học nodejs, cùng chia sẽ để phát triển nhé.
Thanks !
- Các bạn dowload sourse về, giải nén, tạo cơ sở dữ liệu "node_cms_database" export cở sở dữ liệu trong thư mục database (mongodb).
-
@Bảo-Quốc-Nguyễn Đề nghị bác này sau này đóng gói thì remove thư mục node_modules đi
Các gói cài đặt thì lưu nó vào file package.json đó
Khi cài thì chạy npm install abc-xyz --save
-
@Bảo-Quốc-Nguyễn Cho lên github đi bạn ơi. Mọi người
fork
hoặccontribute
dễ dàng hơn. Và như vậy cũng chuyên nghiệp hơn
-
Lên github dễ focus hơn bạn ơi :))
-
Commit lên github đi @Bảo-Quốc-Nguyễn . Mà chủ đề là gì vậy?
-
Khi mình chạy bị lỗi như thế này, hình như thiếu file language thì phải
Error: ENOENT: no such file or directory, open 'D:\nodejs\node_cms\language\language_vi.json' at Object.fs.openSync (fs.js:584:18) at Object.fs.readFileSync (fs.js:491:33) at D:\nodejs\node_cms\controller\front_end\infomation\contact.js:11:34 at Layer.handle [as handle_request] (D:\nodejs\node_cms\node_modules\express\lib\router\layer.js:95:5) at next (D:\nodejs\node_cms\node_modules\express\lib\router\route.js:131:13) at Route.dispatch (D:\nodejs\node_cms\node_modules\express\lib\router\route.js:112:3) at Layer.handle [as handle_request] (D:\nodejs\node_cms\node_modules\express\lib\router\layer.js:95:5) at D:\nodejs\node_cms\node_modules\express\lib\router\index.js:277:22 at Function.process_params (D:\nodejs\node_cms\node_modules\express\lib\router\index.js:330:12) at next (D:\nodejs\node_cms\node_modules\express\lib\router\index.js:271:10) at Function.handle (D:\nodejs\node_cms\node_modules\express\lib\router\index.js:176:3) at router (D:\nodejs\node_cms\node_modules\express\lib\router\index.js:46:12) at Layer.handle [as handle_request] (D:\nodejs\node_cms\node_modules\express\lib\router\layer.js:95:5) at trim_prefix (D:\nodejs\node_cms\node_modules\express\lib\router\index.js:312:13) at D:\nodejs\node_cms\node_modules\express\lib\router\index.js:280:7 at Function.process_params (D:\nodejs\node_cms\node_modules\express\lib\router\index.js:330:12) at next (D:\nodejs\node_cms\node_modules\express\lib\router\index.js:271:10) at D:\nodejs\node_cms\node_modules\express\lib\router\index.js:618:15 at next (D:\nodejs\node_cms\node_modules\express\lib\router\index.js:256:14) at Function.handle (D:\nodejs\node_cms\node_modules\express\lib\router\index.js:176:3) at router (D:\nodejs\node_cms\node_modules\express\lib\router\index.js:46:12) at Layer.handle [as handle_request] (D:\nodejs\node_cms\node_modules\express\lib\router\layer.js:95:5)
-
@hongduy Cài đủ gói trong package.json chưa
-
@Bui-Huy mình chạy node app thiếu gói nào mình cài gói đó, mà chạy vẫn bị lỗi bạn ơi.
$ node app Connect to server at port 8000 !
không biết bị thiếu file gì nữa.
Bạn có thể cho mình xin file package.json đc ko.
chắc mình cài thiếu file gì đó
-
@hongduy Của thím chủ topic share á. Mình đâu có file package :))))
-
@Bui-Huy èo, tưởng đâu bạn cài chạy rồi chứ, file package của chủ topic chỉ có những cái dev nhưng thiếu nhiều ko require trong đó, nên chạy bị thiếu, cái này thông báo thiếu file.
@@
-
@Bui-Huy đã giải quyết được vấn đề rồi.
node_cms\language vào trong thư mục vi copy file lang.json ra ngoai thứ mục language rồi rồi tên thành language_vi.json là chạy
-
@hongduy thử tạo 1 file D:\nodejs\node_cms\language\language_vi.json như này xem
Dự 96% là được
-
@Khoa-Lê-Duy cảm ơn bạn, mình tạo lúc nãy chạy ok rồi, source còn lỗi nhiều lắm
-
@hongduy
Xem đoạn code nó báo vậy
và trong code bác này viết nó thế
Chưa chạy thử nhưng chắc là nó vậy
-
Các bạn dowload sourse về, giải nén, tạo cơ sở dữ liệu "node_cms_database" export cở sở dữ liệu trong thư mục database (mongodb).
(tham khảo cách import dữ liệu mongodb tại đây : http://o7planning.org/vi/10279/import-va-export-co-so-du-lieu-mongodb)
Chạy câu lệnh nodemon (Câu lệnh này sẽ tải đầy đủ các gói packed để chạy )để start server
Chúc các bạn thành công ! Hiện tại đang rất bận, bạn nào chưa cài đặt được nt skype cho mình, khi nào rãnh mình team viewer cài đặt giúp.
Skype: quocbao_design