Git Product home page Git Product logo

typescript-rest-boilerplate's Introduction

Features

  • Decorator based API. Throw away your boilerplate code :hooray
  • Сluster bootstrap out of the box
  • morgan for logging
  • JWT tokens for security. See security decorator
  • MongoDB connector
  • TODO: MongoDB examples... in progress

Initial setup

npm install

Swagger Docs Generation

npm run swagger

Project run

npm start

Start project in cluster

npm start:cluster

Docker build and run

npm run build
docker-compose up -d

UI Test

Just go to http://127.0.0.1:3000

Test

npm run test

Test with coverage reports:

npm run test:coverage

The coverage report will be saved under ./reports/coverage folder.

typescript-rest-boilerplate's People

Contributors

ad0bert avatar creadicted avatar danielrose avatar dependabot[bot] avatar pquiringgit avatar thiagobustamante avatar vrudikov avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

typescript-rest-boilerplate's Issues

Generate GraphQL Schema?

Hi, do you have plans to support generating existing REST to GraphQL schema like you have already for Swagger? Awesome project, by the way. Thanks!

HTTP 404: "Cannot GET /"

$ git clone https://github.com/vrudikov/typescript-rest-boilerplate
$ cd typescript-rest-boilerplate/
$ npm install
$ npm run swagger
$ npm run build
$ docker-compose up -d

This works fine.

$ docker ps
CONTAINER ID        IMAGE                                                     COMMAND                  CREATED             STATUS              PORTS                      NAMES
2977545f512e        typescript-rest-boilerplate_typescript-rest-boilerplate   "docker-entrypoint.s…"   4 minutes ago       Up 4 minutes        0.0.0.0:3000->3000/tcp     typescript-rest-boilerplate_typescript-rest-boilerplate_1
ce8bbe5d18fe        mongo:latest                                              "docker-entrypoint.s…"   4 minutes ago       Up 4 minutes        0.0.0.0:27017->27017/tcp   typescript-rest-boilerplate_mongo_1

But when I go to http://127.0.0.1:3000 (as suggested under UI Test), I get a 404 response with this body:

Cannot GET /

I expected a clearer indication that the service is up and running; should I?

Cannot start up docker-compose

I just tried checking out master and starting this project up using the commands in the readme.

npm install
./build.sh
docker-compose up

And I got an error from the api server:

typescript-rest-boilerplate_1 | Error starting server: Unexpected token export

I didn't make any local modifications or anything so I'm not sure why it wouldn't work. I'm on a mac with macos v10.12.6, npm v5.10.0, node v8.12.0, docker-compose v1.23.2, docker v18.09.2.

Is this something in my environment that is messed up? I can give more information if needed.

cannot npm start

I cloned the repo and called npm install - however, I cannot npm start. Can you help me?
Regards, Mario

C:\code\typescript-rest-boilerplate>npm start

[email protected] start C:\code\typescript-rest-boilerplate
ts-node src/index.ts

Error starting server: C:\code\typescript-rest-boilerplate\dist\swagger.json: ENOENT: no such file or directory, open 'C:\code\typescript-rest-boilerplate\dist\swagger.json'
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! [email protected] start: ts-node src/index.ts
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\MMU\AppData\Roaming\npm-cache_logs\2019-08-23T09_30_04_981Z-debug.log

npm test fails

I expected npm test to succeed in a fresh clone of the repo, but it throws lint errors about console.log and an unnecessary semicolon.

$ git clone https://github.com/vrudikov/typescript-rest-boilerplate && cd typescript-rest-boilerplate && npm install && npm run swagger && npm run test
Cloning into 'typescript-rest-boilerplate'...
[...]

> [email protected] lint /home/alling/typescript-rest-boilerplate
> tslint ./src/**/*.ts ./test/**/*.ts


ERROR: src/controller/hello-admin-controller.ts:34:9 - Calls to 'console.log' are not allowed.
ERROR: src/model/admin.ts:11:2 - Unnecessary semicolon

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] lint: `tslint ./src/**/*.ts ./test/**/*.ts`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/alling/.npm/_logs/2020-03-04T09_44_56_409Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] pretest: `cross-env NODE_ENV=test npm run build && npm run lint`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] pretest script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/alling/.npm/_logs/2020-03-04T09_44_56_421Z-debug.log

CORS

How do I set Cors for this application? Any Example would be useful. Thanks. I tried using express-cors but it seems to be not working as expected.

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.