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
NotificationsYou must be signed in to change notification settings

topcoder-platform/groups-api-v6

Repository files navigation

Group API built on modern frameworks for managing all group-related Topcoder needs.

Project setup

$ pnpm install

Compile and run the project

# development$ pnpm run start# watch mode$ pnpm run start:dev# production mode$ pnpm run start:prod

Database

# run postgres in docker, or other approachdocker run -p 5432:5432  -e POSTGRES_PASSWORD=mysecretpassword postgres:14export DATABASE_URL="postgresql://postgres:mysecretpassword@localhost:5432/group-api?schema=groups"# run migrationnpx prisma migrate dev# seed datanpx prisma db seedornpx prisma migrate reset# if you modify prisma schema, run migration again# and it'll ask# Enter a name for the new migration:# just provide a good migration name, such as#- `add_user_table`#- `update_user_fields`#- `create_posts_table`#- `add_email_to_users`#- `update_foreign_keys`

Data import

  • create a .env filemv .env.sample .env
  • update the postgres database url in .env file —DATABASE_URL="postgresql://postgres:mysecretpassword@localhost:5432/group-api?schema=groups"
  • install dependenciespnpm install
  • run the prisma migrationnpx prisma migrate dev
  • run the prisma seednpx prisma db seed
  • run the projectpnpm run start

Test API

  • import Postman collection. The files aredoc/Group API.postman_collection.json anddoc/Group.postman_environment.json
  • set env to suit your environment
  • run mock apinode mock/mock-api.js
  • reset seed datapnpm run seed-data
  • start apppnpm run start:dev
  • generate the token
curl --request POST \  --url https://auth0proxy.topcoder-dev.com/token \  --header'content-type: application/json' \  --data'{"auth0_url": "https://topcoder-dev.auth0.com/oauth/token", "client_id":"8uHVTW2WHp8BbBPX7J0YTAwgYbYTfjsM","client_secret":"hQXGeKO-cSZ15CLBNRDGZAGRcHWay6PAR_zTQQz4YjdX7QNU7NwGoaa3YuuUYvUv","audience":"https://m2m.topcoder-dev.com/","grant_type":"client_credentials"}'

For a read-only scope M2M token, use:

"client_id":"dgrh9mkk8N6sWsVPFf6JqdVmjjuibowf""client_secret":"_6jFqIppsA3u87Tm7mRDXhX_yf8-DC2ooc5f0affjuWoRiLG1ZriHtUsMQgo61qp"
  • then you can use Postman to test all apis
  • Swagger docs are accessible athttp://localhost:3000/api-docs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp