Coder Social home page Coder Social logo

garystafford / restify-mongo-typescript-demo Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 123 KB

Example of a simple microservice, written with Node.js 8, Restify 6, Mongoose 4 for MongoDB, and Typescript 2.6.

TypeScript 100.00%
typescript nodejs restify mongodb mongoose node

restify-mongo-typescript-demo's Introduction

Restify-Mongoose-TypeScript Microservice

Work in progress...

Example of a simple microservice, written with Node.js 8.x, Restify 6.x, Mongoose 4.x for MongoDB, and Typescript 2.6. Original project structure based on restify-typescript-seed GitHub project.

Project built in Visual Studio 2017 on Windows using the TypeScript Node.js template.

Working with Project

# recommend using yarn instead of npm
npm install -g yarn

# install node packages
yarn
yarn install

# install typescript globally
yarn global add typescript
tsc --version # 2.6.1

# build continuously
tsc --watch

# transpile typescript
yarn run compile

# mocha for testing
yarn global add mocha

# test (transpiles first)
yarn test

# start (transpiles first)
yarn start

# test local HTTP GET endpoint
curl http://localhost:3000/widgets

# kill node process(es) on Windows
taskkill /F /IM node.exe

Mongo Import Sample Data

Import the supplied set of sample widget documents into the local development instance of MongoDB from the supplied 'data/widgets.json' file.

# windows
SET MONGO_URL=localhost:27017
SET MONGO_USERNAME=<your_username>
SET MONGO_PASSWORD=<your_password>

mongoimport ^
  --host %MONGO_URL% ^
  --username %MONGO_USERNAME% ^
  --password %MONGO_PASSWORD% ^
  --authenticationDatabase admin ^
  --db node-restify-mongodb-development ^
  --collection widgets ^
  --file data/widgets.json ^
  --drop --jsonArray --verbose

SonarQube

Test TypeScript files. Requires SonarQube.

# windows
sonar-scanner ^
  -Dsonar.projectKey=WidgetService ^
  -Dsonar.sources=. ^
  -Dsonar.inclusions=app/**,test/**

restify-mongo-typescript-demo's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.