Giter Site home page Giter Site logo

nodejs-typescript-seed's Introduction

nodejs-typescript

A lightweight node application with 2 servers for the FrontEnd and Backend.

Features :

  • Typescript

  • NodeJs and Express

  • JWT Authentication

  • AMD/CommonJS

  • MongoDB and Mongoose

  • HTML Client server

  • CRUD operations example with Mongoose

  • Sourcemaps

  • Cross domain request supported (CORS)

  • Gulp

  • Typings

  • BrowserSync for SCSS

  • Automatic Build + Release

  • Visual Studio Code Debug

  • Visual Studio Code RestClient

Coming features

Install and Run

  1. run npm install
  2. run gulp start (you can add -port:4242 to start the server on a specific port)

Debug with VSCode

  1. run gulp build:dev
  2. start DEBUG: gulp build:dev in VSCode Debug tab (ctrl + shift + D)

Build and Run with CommonJS

CommonJS provide a simple require output with multiple js files and their associated source maps.

  1. run gulp start:dev

OR

  1. run gulp build:dev
  2. run node .bin/server.js

Build and Run with AMD

AMD concatenates your entire app into a single file (server.js).

  1. run gulp start:release

OR

  1. run gulp build:release
  2. run node .bin/app.js

Options

  • -port to specify a unique port for both the REST and CLIENT servers.
  • -port-rest:3000 to specify the port used by the REST Server.
  • -port-web:3000 to specify the port used by the CLIENT Server.

Configure Authentication

When you first use the project, a http request is considered as a request with an authenticated user if headers contain a Authorization with the value Bearer authenticated. To add your custom authentication logic you can simply modify the auth.ts verifyBearerToken to implement your own authentication mechanism.

nodejs-typescript-seed's People

Contributors

linvi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nodejs-typescript-seed's Issues

Do not return new error on authentication failure

The content of the data returned when the authentication fails is the following :

Error: Session has been revoked!

   at sessionRepository.findById.then (C:\Users\linvi\Source\Repos\nodejs-typescript\bin\server\auth\auth.js:23:33)

   at tryCatcher (C:\Users\linvi\Source\Repos\nodejs-typescript\node_modules\bluebird\js\release\util.js:16:23)

   at Promise._settlePromiseFromHandler (C:\Users\linvi\Source\Repos\nodejs-typescript\node_modules\bluebird\js\release\promise.js:510:31)

   at Promise._settlePromise (C:\Users\linvi\Source\Repos\nodejs-typescript\node_modules\bluebird\js\release\promise.js:567:18)

   at Promise._settlePromise0 (C:\Users\linvi\Source\Repos\nodejs-typescript\node_modules\bluebird\js\release\promise.js:612:10)

   at Promise._settlePromises (C:\Users\linvi\Source\Repos\nodejs-typescript\node_modules\bluebird\js\release\promise.js:691:18)

   at Async._drainQueue (C:\Users\linvi\Source\Repos\nodejs-typescript\node_modules\bluebird\js\release\async.js:138:16)

   at Async._drainQueues (C:\Users\linvi\Source\Repos\nodejs-typescript\node_modules\bluebird\js\release\async.js:148:10)

   at Immediate.Async.drainQueues (C:\Users\linvi\Source\Repos\nodejs-typescript\node_modules\bluebird\js\release\async.js:17:14)

   at runCallback (timers.js:637:20)

   at tryOnImmediate (timers.js:610:5)

   at processImmediate [as _immediateCallback] (timers.js:582:5)

It provides content that should be hidden

Fix gulp start

When starting gulp start, the build process is not yet complete but the serve task starts.
An error stating that server.js does not exist is raised before the process can actually detect the file being created.

Ability to host website

In addition to the service, give the option to host a website on the same port or on another one.

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.