node.js - node服务的路径问题
伊谢尔伦
伊谢尔伦 2017-04-17 14:45:40
0
2
735

加入我在根目录下的bulid目录下有一个服务器js文件,执行后将监听localhost:8080端口,然后进入这个目录执行,那么这个时候服务器根目录是在哪里呢?build下还是根目录?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
左手右手慢动作

The root directory of the server is the root directory, build is just a folder, equivalent to a path

阿神

The questioner probably thought that Node.js is the same as PHP. By uploading the file directly to the server, you can access a certain URL to run the program, so he naturally struggled with the issue of relative paths.

In fact, the routing of Node.js is registered through a program. Instead of accessing an address like /ooxx/xxoo.js, it is to run the ooxx/xxoo.js file. Similarly, static resource files are generally registered through the static middleware. to specify the root directory, so the specific method depends on how your program is written.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template