All Projects → nmanikiran → rest-api-node-typescript

nmanikiran / rest-api-node-typescript

Licence: other
This is a simple REST API with node and express with typescript

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to rest-api-node-typescript

express-ts-api-boilerplate
Express TypeScript API Boilerplate
Stars: ✭ 15 (-90.26%)
Mutual labels:  nodemon, joi, joi-validation
wily
Build Node.js APIs from the command line (Dead Project 😵)
Stars: ✭ 14 (-90.91%)
Mutual labels:  sequelize, joi
express-mongoose-es8-rest-api
A Boilerplate for developing Rest api's in Node.js using express with support for ES6,ES7,ES8 ,Mongoose,JWT for authentication,Standardjs for linting
Stars: ✭ 20 (-87.01%)
Mutual labels:  nodemon, joi
express-mysql-rest
Building the simple api with sequelize, mysql and express js. this repository contains the code about how to use sequelize with mysql at express js. for example i have provide the crud operation to this repository. You can also testing the api with chai and mocha with chai-http by this repository
Stars: ✭ 25 (-83.77%)
Mutual labels:  sequelize, nodemon
typescript-express-rest-api
This template will help you to build your own Node.js Express Mongodb API in TypeScript.
Stars: ✭ 42 (-72.73%)
Mutual labels:  restapi, joi-validation
ahobsu-node-backend
🌈 MOTI ! Make Own True Identity ⭐️ 유니큐와 유초코파이 노드로 탈주하다😎
Stars: ✭ 16 (-89.61%)
Mutual labels:  sequelize, nodemon
hapi-good-winston
A good reporter to send and log events with winston
Stars: ✭ 21 (-86.36%)
Mutual labels:  logger, winston
TypeScript-in-Nodejs-Starter
A starter kit for Node.js project written with TypeScript.
Stars: ✭ 39 (-74.68%)
Mutual labels:  winston, sequelize
koa2-winston
koa2 version winston logger like express-winston
Stars: ✭ 37 (-75.97%)
Mutual labels:  logger, winston
nestlogger
Logger library for NestJs services
Stars: ✭ 28 (-81.82%)
Mutual labels:  logger, winston
winston-dev-console
Winston@3 console format aimed to improve development UX
Stars: ✭ 88 (-42.86%)
Mutual labels:  logger, winston
toi
A TypeScript validation library capable of inferring types
Stars: ✭ 25 (-83.77%)
Mutual labels:  joi, joi-validation
ErrorHeroModule
💎 A Hero for your Zend Framework/Laminas, and Expressive/Mezzio application to log ( DB and Mail ) and handle php errors & exceptions during Mvc process/between request and response
Stars: ✭ 47 (-69.48%)
Mutual labels:  logger
Multiplatform-Log
Kotlin Multi Platform Logger, for android an ios : Logcat & print
Stars: ✭ 49 (-68.18%)
Mutual labels:  logger
mall-by-react
一个react商城客户端和egg服务端
Stars: ✭ 22 (-85.71%)
Mutual labels:  sequelize
management tools
A collection of scripts and packages to simplify OS X management.
Stars: ✭ 93 (-39.61%)
Mutual labels:  logger
sequelize-db-export-import
Generater models from mysql db or import tables from models files
Stars: ✭ 26 (-83.12%)
Mutual labels:  sequelize
node-sequelize
nodejs使用sequelize的api测试应用
Stars: ✭ 29 (-81.17%)
Mutual labels:  sequelize
flor
FLOR: Fast Low-Overhead Recovery. FLOR lets you log ML training data post-hoc, with hindsight.
Stars: ✭ 123 (-20.13%)
Mutual labels:  logger
KmLogging
Kotlin multiplatform logging. High performance, composable and simple to use.
Stars: ✭ 21 (-86.36%)
Mutual labels:  logger

REST API with Node using Typescript

This is a simple REST API developed using node and express with typescript

alt text

❤️ Found this project useful?

If you found this project useful, then please consider giving it a ⭐️ on Github and sharing it with your friends via social media.

Requirements

Node.js, postgresql

Getting Started

Setup DB

  1. You need to install PostgreSQL

    • For Windows

      • Install PostgreSQL and set following environment variable C:\Program Files\PostgreSQL\10\bin, C:\Program Files\PostgreSQL\10\lib
    • For Ubuntu

      • Installation sudo apt update sudo apt-get install postgresql postgresql-contrib

      • Manage PostgreSQL service sudo systemctl {status | start | restart | stop} postgresql

  2. rename .env-sample to .env in the file the DB connection string need to be updated according to your credentials. ex : postgres://<YourUserName>:<YourPassword>@localhost:5432/<YourDatabase>

  3. you can find the DB and other details under src/db create a database with the name node-typescript-rest-api and then run/ import the .sql files (extract the sql files from sql.zip). Or you can run npm run seed.

  4. install pm2 globally with npm install -g pm2

Run the app locally

  • git clone https://github.com/nmanikiran/rest-api-node-typescript.git

  • npm install

  • npm start - This will start the application and run on port 3000

  • npm run dev - This will start the application in development mode

  • npm run watch & pm2 start ecosystem.config.js to start the application with cluster for scalability

you can change port in .env file check .env-sample

Folder Structure

src
└───index.ts          # Application entry point
└───routes            # Application routes / endpoints
└───controllers       # Express route controllers for all the endpoints of the app
└───repositories      # All the database interaction logic is here
└───db                # DB related files like connection / seed data
└───handlers          # Common logic
└───logs              # application logs
└───middlewares       # express middlewares
└───models            # DB Models (Postgress)
└───validators        # API Request object validations

Features

  • CRUD operations for Courses
  • CRUD operations for Lessons
  • REST API Request object validations - Basic
  • Error Logs
  • Setup docs
  • Seeder for DB

Planned

  • JWT login
  • Unit Testing
  • Postman collections
  • Improve request Object Validations
  • Improve Error Messages for request failures
  • Project / DB Setup in Ubuntu - Docs
  • Security
  • Hosting

REST Services

The application exposes a few REST endpoints

HTTP GET /api/lessons

HTTP GET /api/lessons/:id

HTTP GET /api/courses

You can use the following code snippet to call the secured endpoint:

fetch("http://localhost:3000/api/courses", {
  method: "GET",
  headers: {
    "Content-Type": "application/json",
  },
})
  .then((response) => {
    if (response.status === 200) {
      response.json().then((j) => console.log(j));
    } else {
      console.log("ERROR", response.status);
    }
  })
  .catch((error) => console.log(error));

Created & Maintained By

Mani Kiran
Mani Kiran N

💻 📖 🤔 👀 🚧
Tushar Gupta
Tushar Gupta

💻 📖 💬 🚧

Feel free to reach out to me through @nmanikiran if you have any questions or feedback!

Recommended / Preferred

VSCode

Thanks & Credits to

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