Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Backend Api for NepalToday Podcast app

NotificationsYou must be signed in to change notification settings

siristechnology/nepaltoday-podcast-api

Repository files navigation

A graphql based api endpoint for NepalToday Podcast mobile app and Admin Dashboard in ReactIt is set to auto-deploy tohttps://dashboard.heroku.com/apps/nepaltoday-podcast-api-qa

Node CIDeepScan gradecodecov

GraphQL

graphql

Prerequisites

  • MongoDB
  • Node 14+

Steps to run

  1. yarn --to install npm modules
  2. Create .env file as per .env.sample file. Get actual values from Heroku env if you need to.
  3. Don't checkin .env file
  4. yarn dev --to start api-server and worker in development mode
  5. yarn start --to start api-server and worker in prod mode
  6. jest --runInBand -t 'some test description' -- it will run tests withsome test description init description
  7. yarn lint --to show linting errors. Add [--fix] to auto fix errors.

Key points

  1. Uses mongoose as ORM for mongodb
  2. Mongoose schema at /src/db-service/mongooseSchema.js

Most basic MongoDB commands (terminal)

  • show dbs --to show all dbs
  • use nepaltodaydb --to switch to nepaltodaydb
  • show collections --to show all collections/tables
  • db.articles.find() --to show all articles in the collection
  • db.articles.find({title: 'new title'}) --to show article/articles with title = 'new title'
  • db.articles.find({}, {title: 1}) --to show title field of all articles (no criteria)
  • db.articles.remove({}) --to remove all articles documents
  • db.articles.remove({title: 'new title'}) --to remove all articles with title = 'new title'
  • db.articles.update({_id:{$exists:true}}, { $set: {createdDate: '2019-01-01'}}, {multi: true}) --to update multiple articles with createdDate = '2019-01-01'
  • db.articles.find().sort({_id: -1}).limit(10) -- to display latest articles (i.e order by descending and take 10 records)

Some helpful commands

  1. Runkill-port 4000 to kill process in port 4000. kill-port is a npm module

Contributors12


[8]ページ先頭

©2009-2025 Movatter.jp