All Projects → skopekreep → typescript-node-express-realworld-example-app

skopekreep / typescript-node-express-realworld-example-app

Licence: other
Rewrite of JS-based node-express RealWorld backend app using Typescript.

Programming Languages

typescript
32286 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to typescript-node-express-realworld-example-app

Laravel Realworld Example App
Exemplary real world backend API built with Laravel
Stars: ✭ 954 (+783.33%)
Mutual labels:  realworld
Effector React Realworld Example App
Exemplary real world application built with Effector + React
Stars: ✭ 119 (+10.19%)
Mutual labels:  realworld
Rust Yew Realworld Example App
Exemplary real world app built with Rust + Yew + WebAssembly
Stars: ✭ 249 (+130.56%)
Mutual labels:  realworld
Express Bookshelf Realworld Example App
🐳 An Express and Bookshelf based backend implementation of the RealWorld API Spec.
Stars: ✭ 45 (-58.33%)
Mutual labels:  realworld
Cakephp Realworld Example App
Stars: ✭ 103 (-4.63%)
Mutual labels:  realworld
Ember Realworld
Ember.js RealWorld Implementation
Stars: ✭ 150 (+38.89%)
Mutual labels:  realworld
Spring Boot Realworld Example App
Example Spring codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld API spec.
Stars: ✭ 700 (+548.15%)
Mutual labels:  realworld
scala-http4s-realworld-example-app
Example of a RealWorld app backend powered by Scala + http4s
Stars: ✭ 35 (-67.59%)
Mutual labels:  realworld
Golang Gin Realworld Example App
Exemplary real world application built with Golang + Gin
Stars: ✭ 1,780 (+1548.15%)
Mutual labels:  realworld
Realworld Dynamodb Lambda
λ serverless backend implementation for RealWorld using AWS DynamoDB + Lambda
Stars: ✭ 185 (+71.3%)
Mutual labels:  realworld
Seed Rs Realworld
Exemplary real world application built with Seed
Stars: ✭ 77 (-28.7%)
Mutual labels:  realworld
Aspnetcore Realworld Example App
ASP.NET Core backend implementation for RealWorld
Stars: ✭ 1,315 (+1117.59%)
Mutual labels:  realworld
Haskell Scotty Realworld Example App
Exemplary real world backend API built with Haskell/Scotty https://realworld.io
Stars: ✭ 162 (+50%)
Mutual labels:  realworld
Realworld Nuxt
Nuxt.js implementation of RealWorld Frontend
Stars: ✭ 45 (-58.33%)
Mutual labels:  realworld
akka-http-realworld-example
Exemplary real world application built with Scala + Akka HTTP https://realworld.io
Stars: ✭ 30 (-72.22%)
Mutual labels:  realworld
Elixir Phoenix Realworld Example App
Exemplary real world application built with Elixir + Phoenix
Stars: ✭ 764 (+607.41%)
Mutual labels:  realworld
Gcp Datastore Cloud Functions Realworld Example App
Serverless GCP Cloud Functions + Datastore implementation of RealWorld Backend
Stars: ✭ 122 (+12.96%)
Mutual labels:  realworld
moleculer-node-realworld-example-app
Exemplary real world application built with Moleculer
Stars: ✭ 102 (-5.56%)
Mutual labels:  realworld
re-frame-realword-example-app
Exemplary real world application built with Clojurescript and re-frame
Stars: ✭ 16 (-85.19%)
Mutual labels:  realworld
React Redux Typescript Realworld App
RealWorld App implementation based on "react-redux-typescript-guide"
Stars: ✭ 178 (+64.81%)
Mutual labels:  realworld

RealWorld Example App

Example Typescript Node (Typescript + Node + Express + Mongoose) codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

Demo    RealWorld

This codebase was created to demonstrate a fully fledged fullstack application built with Typescript Node including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the Typescript Node community styleguides & best practices.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

Getting started

To get the Node server running locally:

  • Clone this repo
  • npm install to install all required dependencies
  • Install MongoDB Community Edition (instructions) and run it by executing mongod
  • Copy .env.example to .env and enter all variables.
  • npm run start to start the local server.

Application Structure

  • server.ts - The entry point to our application.
  • app.ts - This file defines our application and connects it to MongoDB using mongoose. It also requires the routes and models we'll be using in the application.
  • database/ - This folder contains he schema definitions for our Mongoose models and database connection code.
  • routes/ - This folder contains the route definitions for our API.
  • interfaces/ - This folder contains the interfaces for models
  • utilities/ - This folder contains the environment variables, passport authentication code, logger amd error handling logic.

Error Handling

In utilities/error-handling.ts, we define all error-handling middleware for handling all server errors. It will respond with error-specific status code and format the response to have error messages the clients can understand

Authentication

Requests are authenticated using the Authorization header with a valid JWT. We define two express middlewares in routes/auth.js that can be used to authenticate requests. The required middleware configures the express-jwt middleware using our application's secret and will return a 401 status code if the request cannot be authenticated. The payload of the JWT can then be accessed from req.payload in the endpoint. The optional middleware configures the express-jwt in the same way as required, but will not return a 401 status code if the request cannot be authenticated.


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].