Coder Social home page Coder Social logo

nodejs_api's Introduction

nodejs_api

nvm安装

cd /usr/local/src

git clone https://github.com/cnpm/nvm.git

source ./nvm/nvm.sh

nvm --version

0.26.1 //查看当前所有版本

nvm ls-remote //查看所有可用版本

nvm install v7.0.0 node -v

v7.0.0 //安装验证node版本

express api安装

npm init; npm install -g express-generator; express node-api; //node-api api文件夹名称; cd node-api; npm install;

编写api

并且更改api的备注

npm start;

apidoc安装

npm install apidoc -g; apidoc -i /home/www/appapi/node-api/ -o /home/www/appapi/node-api/dest; //dest apidoc的文件夹名称

forever 安装

npm install forever -g;

cd /home/www/appapi/node-api;

forever start -c 'npm start' ./ ;

nginx config

server {

listen 80;

server_name api.likang-web.com;//绑定api域名

location / {

    proxy_set_header X-Real-IP $remote_addr;

    proxy_pass    http://127.0.0.1:3000;

}

}

apijson

{

"name": "node-api",

"version": "0.1.0",

"description": "",

"title": "Test API",

"description": "Test API for Web",

"url" : "http://api.likang-web.com",

"sampleUrl" : "http://api.likang-web.com",

"template": {

"withCompare": true,

"withGenerator": true

}

}

apis.js

/**

  • @api {post} /api/images post

  • @apiGroup images

  • @apiParam {Int} id

  • @apiParam {String} user

  • @apiParam {String} email

  • @apiSuccess {Object} result

*/

nodejs_api's People

Contributors

likang19870916 avatar

Watchers

 avatar

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.