Giter Site home page Giter Site logo

survey's Introduction

survey

  • 18年4月9日更新(angular5版本):
    1. 加上了oauth2.0
    2. 加上角色权限设计
    3. 模块设计,懒加载
  • 18年3月18日更新: 加上了ionic版本

本项目是一个做题的demo, 包括egg.js, mongodb的后台,提供restful服务, 前端现在有3个,一个是用angular5和ng ant design做的,另一个是react和ant design mobile做的,还有一个是ionic版本

很简单的4步就可以开发一个新的restful服务:

  1. 定义一个model,比如app/model/survey.js
  2. 在app/service里面新建一个对应的service surveys.js,并继承DaoService
  3. 在app/controller里面新建一个对应的controller surveys.js,并继承CommonController
  4. 在router.js里面加上下面2句路由,就成功了
 router.post(api + '/surveys/search', controller.surveys.index);
 router.resources('surveys', api + '/surveys', controller.surveys);

上面的操作默认提供了增删改查的restful接口

method url 说明
GET api/v1/surveys/:id 根据id来查找资源
POST api/v1/surveys 根据request body里的json数据来创建新的surveys
PUT api/v1/surveys/:id 更新指定id里的数据
DELETE api/v1/surveys/:id 删除指定id里的数据

POST api/v1/articles/search?page=:page&pageSize:pageSize 搜索数据,这个是约定的搜索方式,非常简单,不用写额外代码

{
 eqs: {name:'eq'},\\找出字段name为eq的数据
 likes: {name:'like'}\\找出字段name包含有like的数据
 ins: {status: ['NEW', 'END']}\\找出字段status是NEW或者END的数据
 times: {created: {start: 1511280000000, end: 1513699200000}}\\找出字段created在这个start和end时间段的数据
 sorts:{name:'asc'}\\按照字段name升序, asc是升序,desc是降序
}

survey's People

Contributors

leegang2017 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

guchenhui soluttt

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.