Giter VIP home page Giter VIP logo

cs5-7328-project-2023-fall-backend's Introduction

Express Node.js App for Backend

rest-api-express-nodejs-app

Description

Express.js Node.js app for backend, Rest API, and Prisma ORM.

Project Structure

├── jest.config.js
├── package.json
├── package-lock.json
├── prisma
│   ├── index.ts                            # Database client, you can call this instead of create a new client in each function
│   └── schema.prisma
├── README.md
├── src                                     # Source files, write your code under this folder
│   ├── app.ts                              # Entry of the application
│   ├── server.ts                           # Configure the server
│   ├── middleware                          # Middleware folder, write your middleware under this folder, you can add more middleware base on your need
│   │  └── authentication.ts                # Authentication middleware, we are not yet develop it, we can implement it later
│   └── modules                             # define your modules here, you can add more modules base on your need, please refer the user module for standard
│       ├── user.controller.ts              # define your controller here, which is responsible for handling request and response, query data from service
│       ├── user.routes.ts                  # define routes and api endpoints
│       └── user.service.ts                 # data access layer, for database operation
├────── __test__                            # Test folder, write your test case under this folder
│       └── app.test.ts
└── tsconfig.json

Installation

npm install

Start your database server on port 3306, and run the following command to create the database schema:

npx prisma db push

npx ts-node prisma/seed.ts

import testing data to database, if any duplicate happend, try remove all data in your database

Available Script

npm test

run your test cases with jest and supertest

npm run dev

run your application in development mode

npm run build

build your application to dist folder

npm run start

run your application in production mode

References

Testing with Jest and Supertest(Javascript): https://www.albertgao.xyz/2017/05/24/how-to-test-expressjs-with-jest-and-supertest/ Best Practice with nodejs: https://github.com/goldbergyoni/nodebestpractices?ref=blog.treblle.com

cs5-7328-project-2023-fall-backend's People

Contributors

austinwerth27 avatar blake-gebhardt avatar ecmgit avatar gmongaras avatar hannahlouis avatar henryaudi avatar jialefan1 avatar jiangd22 avatar jurech avatar karinashin avatar llmalone avatar lonesometown avatar millerb7 avatar mingyao1 avatar sithsiri avatar smjd11 avatar snehagalex 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.