nartc / tsoa-sandbox

TSOA with Node Express

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TSOA-Sandbox

A personal project utilizing TSOA with Node, Express and MongoDB for the Server; Angular 5 for the Client.

Progress

  • (Latest) I haven't made much progress over the last couple of days. All the commits were testing Heroku and Service Worker. Fetching data wise, I have been able to fetched the right data for the User (using their JWT issued on successfully login).
  • (Jan 13 2018) Deployed to Heroku as-is. Going to implement more on the Client-side when I've got time to work with it.
  • (Jan 12 2018) Tested out the ApiClient that Swagger-Codegen generated. Everything worked out pretty well. I also initialized Angular-Redux from @angular-redux/store. This is going well so far.
  • (Jan 11 2018) Initialized Angular 5 Frontend. I also tried to include Angular's Service Worker in this project. Let's see how far we can go. Swagger-Codegen is also working as expected. Good day!!
  • (Jan 10 2018) Finally got Passport integrated successfully. My routes can be protected with just one line of code (@Security('JWT')). Going to implement the rest of TaskController then move on to Frontend.
  • (Jan 10 2018) I've made some changes to UserController and finally got SwaggerUI integrated and working. The models are rendered fine. Next is to implement another actor into the application then move on to front-end.
  • (Jan 09 2018) What a rough day! I've been looking for a working AutoMapper for JS/TS but to no-avail. I've looked at Automapper-ts but the author explicitly said he didn't build the package for using Node specifically. I am going to rewrite my UserController tomorrow.
  • (Jan 08 2018) I've completed utilizing Repository Pattern for the controllers and successfully generated the routes.ts file for the backend. Next, I'm looking into injecting SwaggerUI into the project. TSOA, so far, has been working wonder for me. One of the roadblocks was I want to use 3rd party package like passportJS to have protected route. However, the routes are generated by TSOA. Hence, I had to create a custom-template that will inject passport.authenticate middleware into the routes.ts template. I haven't tested the result but will definitely have it tested in the next commit.
  • (Jan 06 2018) I was fascinated by the almighty Swagger (aka OpenAPI) and was really excited to discover TSOA package. As I am trying to integrate TypeScript with Node Express backend, I decide to start on a project with TSOA. A lot of roadblocks at first but eventually, I found solutions for most of them.

Steps to get the environment ready

  1. Install nodemon globally if haven't
  2. Install rimraf globally if haven't
  3. (Optional for generating Code for Angular front-end) Install swagger-codegen if haven't. Visit: https://github.com/swagger-api/swagger-codegen
  4. Clone the project.
  5. Read config/default-example.yaml
  6. Run npm install on both the Server and Client side (angular-src)

Steps to start the project

  1. Run npm run start-gen-dev on project's root directory
  2. Open a new terminal (still at the project's root), run npm run swagger-client
  3. Open your browser on: localhost:8080/api/docs to check out the SwaggerUI Documentation
  4. (Optional) If you want to run the Angular front-end, cd ./angular-src then ng serve

Technologies

  1. Node
  2. ExpressJS
  3. MongoDB
  4. TSOA
  5. TypeScript
  6. JWT
  7. PassportJS
  8. Various others

About

TSOA with Node Express


Languages

Language:TypeScript 78.1%Language:HTML 13.5%Language:CSS 6.4%Language:JavaScript 1.2%Language:Shell 0.8%