Original digest self of front-end blog, welcome everyone to visithttp://www.hacke2.cn
About Gokk
College Entertainment is basically in the bedroom to see the film →_→, General will choose to goxiazai.cc on the inside, the resources, high quality. The webmaster will recommend a high ratings of highly acclaimed movies to everyone free download, the overall is really good, but the first two months due to copyright issues forced transformation This is also no way, programmers should respect copyright issues, we can understand, and then the webmaster opened Gokk not to address let you download, But will network some excellent video site resources to provide to watch, the quality has become low, good memory of the former Goxiazai ah.
Recently in learning node. JS, also looked at the source of the IMOOC, their own imitation gokk.tv the front desk has built a node. js + Mongoose + Bootstrap, very simple page, took two days, the first node experience was given to Gokk, Salute to Goxiazai!
Display first page Two Details page add page get source code
Source is hosted in Git
Click to get
Deploy to run
Use NPM to package items and install them using npm install when checked out
Run with the node app , the database uses MONGDB, please install it yourself, test data under Test/db.js
I hope you can make suggestions or comments
Data
Movies below there are columnname to indicate the name of the column, such as movie, animation, entertainment, etc. movie is an array inside the JSON object, representing all the movies under the Change column, so the advantage of non-relational database is that if you followed the low redundancy The principle must be set up two tables to make column and movie one-to-many, and later feel should be more reasonable with two schemas
Function
Home, details page, new
Not implemented: Pagination, view list, background delete, edit
What makes me just write a new feature?
Because it is the first time to write node, in the process of writing a lot of problems, although node provides paging limit, but can only be divided into a table, such as movies this table, can not be a piece of data down the set of the movie array to remove the component.
Later in the Mongoose study reference Document--basic article see there is such a thing sub Docs
As in SQL database, 2 tables have a primary relationship, Mongoose 2 document nesting is called Sub-docs (subdocument) is simply a document nested another document or documents:
This may be I want, but the first development focus is not on the mongoose, node's book is not a lot of reading, this is my learning process of a small test it! Plan to develop two days, if the changes will become more and more deep, I understand that my current node development process has a lot of problems, the process is not correct. I'm getting more and more stuck on this, and it's really not very efficient to write, so other features stop developing immediately.
This is one of the reasons for the semi-finished project.
End from http://www.hacke2.cn
Mimic gokk.tv based on node. js + Jade + Mongoose