当前位置: 首页 > 软件库 > Web应用开发 > >

typescript-api-starter

授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发
软件类型 开源软件
地区 不详
投 递 者 富波光
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Typescript API Starter

Build Status

Starter for Node.js Express API in Typescript.

Requirements

Getting Started

Clone the repository, install the dependencies.

$ git clone git@github.com:cham11ng/typescript-api-starter.git <application-name>

$ cd <application-name>

$ cp .env.example .env # Update database credentials

$ yarn migrate

Load fake data in database.

$ yarn load:fake <FactoryName> <Number>

Start the application.

$ yarn build

$ yarn start # For production

$ yarn start:dev # For development

Using Docker

Make a copy of .env.docker and save as .env.

$ cp .env.docker .env

Install dependencies and run the application locally.

$ docker-compose up -d postgres

$ docker-compose up -d api

$ docker-compose exec api sh yarn migrate # Make sure server is started checking logs before running this command

View logs of the container.

$ docker-compose logs -f

To stop the services.

$ docker-compose stop api postgres

Generating Migrations and Seeds

To create migration use make:migration and seed use make:seeder:

$ yarn make:migration create_{table_name}_table

$ yarn make:seeder {table_name}_table_seeder

Example,

$ yarn make:migration create_posts_table

$ yarn make:seeder post_table_seeder

Modify migration and seeder file as per the requirement. Then finally:

$ yarn migrate # to migrate

$ yarn seed # to seed

Contributing

Feel free to send pull requests.

License

typescript-api-starter is under MIT License.

 相关资料
  • Node.js API com Typescript Código do curso �� DO ZERO A PRODUÇÃO: APRENDA A CONSTRUIR UMA API NODE.JS COM TYPESCRIPT Durante o curso é criado uma API para calcular a melhor condição de surf entre vari

  • Node.js Express API with TypeScript 3 Node.js Express API with TypeScript 3. Supports MongoDB Description This skeleton will help you to build your own Node.js Express Mongodb API using TypeScript 3.

  • Building RESTful Web APIs with Node.js, Express, MongoDB and TypeScript This is a simple API that saves contact information of people. There are two versions of this project. V1.0.0: you can run the s

  • 我试图将一个JSON对象从一个typescript POST调用传递到一个Web API方法。Fiddler显示该对象已转换为JSON,内容类型为“application/JSON”。但在API控制器上,参数值显示为null,而不是JSON。 打字稿: Web API:[HttpPost]公共异步任务CreatePOInMO([FromBody]字符串产品){return Ok();} 产品包含空

  • 像函数参数一样,类有时具有可选成员。 同样的语法可以用于class定义: nickName?: string; 在上面的示例中,的实例保证有一个name,并且可以可选地具有nickName。 修饰符 public:类的每个成员默认为,可以自由被访问。 private:类成员被标记为private时就不能在类的外部访问。 继承与多态 封装,继承和多态是面型对象的三大特性。 TypeScript的