高洛峰2017-04-17 15:17:01
It is recommended to first use express
to write a simple server to practice. Starting directly from the nodejs API is more boring and the effect is not very good.
server can include the following simple content:
Routing: different access paths, returning different pages
Template: Choose a front-end template according to your preference, and then return to the rendered page
Local file reading and writing: For example, a request address returns a local file, so I can practice the file reading and writing API by the way
req/res: Understand its properties, corresponding APIs, etc., and visually review the basics of HTTP
Others: The poster is free to play
app.use('/user', function(req, res, next){
// 。。。
})
怪我咯2017-04-17 15:17:01
Find a topic of interest and use nodejs to make a website or something. For example, if you like photography, you can make a website for photography and photo sharing, and imitate other websites to make one.
Before doing it, make a plan first, what functions will be implemented, and what framework will be used. Once these are decided, let’s start working hard
You will definitely encounter a lot of problems at the beginning. It is recommended to search on stackoverflow
When doing projects using node, you must pay attention to the nodejs version and the express version. Don’t waste a lot of time because of environmental problems