Giter Club home page Giter Club logo

altera-backend's Introduction

Nest Logo

Description

Alter Backend built using Nest framework TypeScript starter repository.

Setup

Before starting, rename .env.sample to .env and update the corresponding variables to real values in order to run the environment.

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Note on e2e testing

In order to get e2e tests running, the corresponding environment variables must be set in .env.test (for reference, see .env.test.sample). You can also just use the dev database ๐Ÿคท if its not too important.

Pagination

This API uses cursor-based pagination and works similar to other conventions with cursor-based pagination.

On listing endpoints (e.g. GET /api/posts), there's a few query params you can attach to the request URL that can help with this.

  • limit : The maximum number of items you want the response to provide.

  • cursor: An id string that points to the next portion of the results.

    • If you don't pass a cursor parameter, but do pass a limit parameter, the default value retrieves the first portion (or "page") of results.

Listing endpoints return a paginated response, which looks like this:

{
  // Array collection of returned items (# of items === `limit` param passed in request)
  "data": [{ item1 }, { item2 }, { item3 }],

  // "Page" metadata containing data that ca be used for subsequent paginated requests
  "meta": {
    "next_cursor": "someRandomeId", // `id` string that points to the next portion of the results.
  }
}
  • An empty, null, or non-existent next_cursor in the response indicates no further results.

  • On your next call to the same method (e.g. GET /api/posts), set the cursor parameter equal to the next_cursor value you received on the last request to retrieve the next portion of the collection.

Misc

Database Model Changes

Any time a model in the schema file is modified in any way, you must run npx prisma generate. This command must be run after every change to Prisma models to update the generated Prisma Client.

Note: The prisma generate command reads the Prisma schema and updates the generated Prisma Client library inside node_modules/@prisma/client.

altera-backend's People

Contributors

nifled avatar

Watchers

 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.