Vapor在mac上的使用

2018-07-07  本文已影响36人  退役程序员Franco

Vapor是一个基于swift的服务端框架

安装

$brew install vapor/tap/vapor

安装完成后,可以使用vapor --help命令查看帮忙

$vapor --help
Usage: vapor command

Join our Slack if you have questions, need help,
or want to contribute: http://vapor.team

Commands:
       new Creates a new Vapor application from a template.
           Use --template=repo/template for github templates
           Use --template=full-url-here.git for non github templates
           Use --web to create a new web app
           Use --auth to create a new authenticated API app
           Use --api (default) to create a new API
     build Compiles the application.
       run Runs the compiled application.
     fetch Fetches the application's dependencies.
    update Updates your dependencies.
     clean Cleans temporary files--usually fixes
           a plethora of bizarre build errors.
      test Runs the application's tests.
     xcode Generates an Xcode project for development.
           Additionally links commonly used libraries.
   version Displays Vapor CLI version
     cloud Commands for interacting with Vapor Cloud.
    heroku Commands to help deploy to Heroku.
  provider Commands to help manage providers.

Use `vapor command --help` for more information on a command.

使用

新建项目

$vapor new Hello
$cd Hello
$vapor xcode

打开Xcode,运行


使用My Mac运行Run

跑起来后,会看到控制台输出:

Server starting on http://localhost:8080

Postman发个Get请求http://localhost:8080/hello,成功就会看到Hello, world!

上一篇下一篇

猜你喜欢

热点阅读