Giter Site home page Giter Site logo

bailicangdu / node-elm Goto Github PK

View Code? Open in Web Editor NEW
12.2K 416.0 3.7K 8.02 MB

Backend system based on node.js + Mongodb. 基于 node.js + Mongodb 构建的后台系统

Home Page: https://cangdu.org/elm/

License: GNU General Public License v2.0

JavaScript 91.92% HTML 8.05% EJS 0.03%
node express mongodb mongoose

node-elm's Issues

配置出错

/Users/tomato/Sites/vue-test/node-elm/app.js:72
  name: _configLite2.default.session.name,
                                    ^

TypeError: Cannot read property 'name' of undefined
    at Object.<anonymous> (/Users/tomato/Sites/vue-test/node-elm/app.js:33:11)
    at Module._compile (module.js:573:30)
    at loader (/Users/tomato/Sites/vue-test/node-elm/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/tomato/Sites/vue-test/node-elm/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/tomato/Sites/vue-test/node-elm/index.js:2:1)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Function.Module.runMain (module.js:609:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:598:3

建议尽量使用一种模块加载方式,配置文件使用module.exports的Commonjs模块加载方式,其他代码多半有使用ES7的模块加载方式

订单详情和数据管理

数据管理那个节点下面有点卡 而且分页也有点卡 建议做个加载动画吧 还有订单详情点击不同的订单信息变为一样了

获取管理员信息失败

// 获取管理员信息
export const getAdminInfo = () => axios.get('/admin/info')
结果为
{"status":0,"type":"ERROR_SESSION","message":"获取管理员信息失败"}
如何才能得到正确的管理员信息

菜鸟学习node过程的一些编程思路疑问,希望能解答

你好,我之前一直是用c++,c#开发得比较多,c和java也有用。现在正学习node和javascript做web开发,但有一些地方还没搞明白。我看了好几本node的书籍,都没有找到项目复杂度比较高的例程,基本是一个知识点一个模块,没有很健全的模块体系,还是搞不清这种异步编程**。你这开源项目做得挺大的,应该能给我答疑。

在C#,C++开发时,是可以主类中定义一些完成不同功能的成员,然后主类的方法中操作这些成员执行相应的功能和逻辑,而成员也可以通过事件或返回值的方式把执行结果反馈到主类。但在搞node+express的时候,就不懂怎样让app.js中的对象和子模块的对象进行交互、不同模块之间要动态传数据时是怎样的方式。比如说,我每个请求路由都独立成js文件了,浏览器有请求的时候,我要返回给浏览器的数据是需要从app.js的对象中获取的,那该怎样跨文件传到我的路由.js文件上?

为什么会出现这个错误,求怎么解决

PS C:\Users\XieHaitao\Desktop\node-elm-master> npm run dev

[email protected] dev C:\Users\XieHaitao\Desktop\node-elm-master
NODE_ENV=development supervisor --harmony index.js

'NODE_ENV' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "ru
" "dev"
npm ERR! node v6.10.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] dev: NODE_ENV=development supervisor --harmony index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script 'NODE_ENV=development supervisor --harmony index.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-elm package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! NODE_ENV=development supervisor --harmony index.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-elm
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-elm
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\XieHaitao\Desktop\node-elm-master\npm-debug.log
PS C:\Users\XieHaitao\Desktop\node-elm-master>

关于登录注册

你好,req.session.admin_id = admin_id;这不意味着每次只能有一个用户登录么?那么我两个用户同时登录怎么办?求大神指点

config-lite load `local` failed

大神这个错误怎么处理啊!!!
Error: Cannot find module 'local' from 'E:\node-elm\mongodb'
at Function.module.exports [as sync] (E:\node-elm\node_modules\resolve\lib\sync.js:33:11)
at loadConfig (E:\node-elm\node_modules\config-lite\index.js:37:26)
at Object. (E:\node-elm\node_modules\config-lite\index.js:22:22)
at Module._compile (module.js:571:32)
at Module._extensions..js (module.js:580:10)
at Object.require.extensions.(anonymous function) [as .js] (E:\node-elm\node_modules\babel-register\lib\node.js:152:7)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at require (internal/module.js:20:19)
at Object. (E:/node-elm/mongodb/db.js:4:1)
at Module._compile (module.js:571:32)
at loader (E:\node-elm\node_modules\babel-register\lib\node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (E:\node-elm\node_modules\babel-register\lib\node.js:154:7)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)

node 是如何支持 es6 module 的

我在搭建项目时添加的 babel 插件和你的一样,但是用 supervisor --harmony 的方式启动的话它不是别 es6 的 module,如果添加 babel 插件,以 babel-node index 的方式启动是可以支持的,但是这样每次修改都需要手动启动一次,请问作者是如何实现这两个的兼容的?有什么更好的解决办法吗?

formidable读不到files?

form.parse(req, async (err, fields, files) => {

此处files读不到数据,我正在调,如果能调好我push。

大神 求助?

为什么用vue写的项目 打包后 访问这个http://cangdu.org:8001/admin/info 这个接口 返回的数据是{"status":0,"type":"ERROR_SESSION","message":"获取管理员信息失败"} 在本地访问没什么问题 本地用的是代理,获取数据使用的是axios 我给它配置了默认路径 axios.defaults.baseURL = process.env.NODE_ENV === 'production' ? 'http://cangdu.org:8001' : '/api';

API接口文档

域名: http://cangdu.org

端口:8001

1.获取城市列表

请求URL:

/v1/cities

示例:

http://cangdu.org:8001/v1/cities?type=guess

请求方式:

GET

请求参数

参数 是否必选 类型 说明
type     Y       string  类型 guess:定位城市, hot:热门城市, group:所有城市

返回示例

{
  id: 1,
  name: "上海",
  abbr: "SH",
  area_code: "021",
  sort: 1,
  latitude: 31.23037,
  longitude: 121.473701,
  is_map: true,
  pinyin: "shanghai"
}

2.获取所选城市信息

请求URL

/v1/cities/:id

示例:

http://cangdu.org:8001/v1/cities/1

请求方式

GET

请求参数

参数 是否必选 类型 说明
id     Y       int   城市id

返回示例

{
  id: 1,
  name: "上海",
  abbr: "SH",
  area_code: "021",
  sort: 1,
  latitude: 31.23037,
  longitude: 121.473701,
  is_map: true,
  pinyin: "shanghai"
}

3.搜索地址

请求URL

/v1/pois

示例:

http://cangdu.org:8001/v1/pois?city_id=1&keyword=迪士尼&type=search

请求方式

GET

请求参数

参数 是否必选 类型 说明
city_id     Y       int   城市id
keyword     Y       string   搜索关键词
type     N       string   搜索类型,默认为search

返回示例

[
    {
        name: "上海迪士尼乐园",
        address: "上海市浦东新区申迪西路753号",
        latitude: 31.14419,
        longitude: 121.66034,
        geohash: "31.14419,121.66034"
    },
    {
        name: "迪士尼",
        address: "上海市浦东新区妙境路1118号家乐福川沙店1层",
        latitude: 31.18183,
        longitude: 121.69279,
        geohash: "31.18183,121.69279"
    },
    ...  //共10个数据
]

上传图片的接口(/v1/addimg/shop),有点问题;

 ...
 await fs.rename(files.file.path, repath);
 gm(repath)
 ...

这里在gm方法执行的时候,报错了,显示找不到repath这个路径;
然后我把fs.rename改成同步的方式就可以了;难道是await在这里没起作用吗;

想请教一下后端的部署问题

大神,您的好几个仓库我都关注了,您简直是我们的福音,但是本人有点菜,我有几个疑惑想不通,想问一下。

我看到 您的域名是同一个 http://cangdu.org,服务器也是同一个(阿里云),在项目很多的情况下,您为每个项目分配不同的端口号或者不同的子文件夹。比如:

疑惑

  1. 我自己的理解是,我们用nodejs,每一个端口是一个服务, 每一个端口 服务, 都需要跑一个命令行,比如(node server.js),是这样的吗? 比如上面5个项目, 应该用了3个nodejs服务器。
  2. 在8003端口的服务,在后端是否要监听不同的路由,(举个例子)http://cangdu.org:8003/index http://cangdu.org:8003/center 这两个路由不同,但是后端都要返回同一个index.html 对吗..?
  3. 8001端口,既有api请求,也会有vue2-elm的很多的页面路由请求,在同一个服务中监听这多个请求,会不会混淆或者不好管理啊?
  4. /pxq/ 和 /manage/ 的两个项目都是80端口的请求,应该是用的同一个server吧? 想知道后端是如何处理的,也是像 上面的3 中 那样监听不同的路由来返回不同项目的 html吗。。?
    比如express的这样:
app.use('/manage', manage); // 渲染manage的html给后台管理系统项目
app.use('/pxq', pxq); // 渲染pxq的html给后台管理系统项目


获取不到定位城市

前端项目里的online地址改成我自己的域名:8001来访问的,公网ip映射到内网对应的ip和端口。

我把addressComponent.js里写死的ip去掉了
然后运行后,前端得到ERR_DATA
后端看显示的是局域网ip无法获取位置

请问这里node-elm应该怎么配置运行才行呢?

async 的问题

大大你好 最近数据显示async会跟别的比较下运行时消耗时间相对较长 有想过未来会换别的异步的方法吗?假如有的话你会首选哪个 想听听你的看法~

厉害了我的哥

我偶然找到这个项目, 我也刚学完node mongodb express, 只是对单元测试还是比较陌生。 感兴趣的话可以一起探讨技术! 我的微信 peterbugman

关于node-elm

cangdu大神,我特别好奇你的node是怎么学的。有点6啊,有何学习网站推荐没?还有你引入的qiniu这个云储存api到底是干嘛用的呢?

数据库

请问数据表能提供下吗,谢谢

English please

hi guys
thank you for your work.
but I think It will be so good if you translate this repo to English.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.