当前位置: 首页 > 软件库 > Web应用开发 > >

rest-api-boilerplate-v2

Boilerplate of a RESTful API
授权协议 Readme
开发语言 JavaScript
所属分类 Web应用开发
软件类型 开源软件
地区 不详
投 递 者 仲孙超
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Setup

npm i

Before running anything locally, create a .env file and initialize your env variable like so:

DB=mongodb://localhost:27017/boilerplate
SECRET_KEY=NSA
REACT_APP_URL=http://localhost:3000 // when cors is enabled, this will be the only origin to send requests

PS: if you're deploying to a VPS/VPC u should have another .env.production file and add some logic to handle that on the ./config/config.js file.

Start the db locally

npm run database

PS: replace mongo-data with the name of the folder your data is stored.

start dev server

npm run dev

start prod server

npm start

Models

User

  • firstName
  • lastName
  • username
  • email
  • password
  • tokens

Profile

  • user
  • type
  • handle
  • date

Post

  • title
  • description
  • date
  • _creator

Routes

  • User

      POST /api/user/register
      // Register a new user and returns user data with the generated token
      // Public
    
      POST /api/user/login
      // Login user and returns user data with the generated token
      // Public
    
      GET /api/user/verify
      // Verifies token and returns current user data
      // Private
    
      DELETE /api/user/logout
      // Logout
      // Private
    
  • Profile

      GET /api/profile
      // GET current user profile
      // Private
    
      POST /api/profile
      // create or Edit user profile
      // Private
    
      DELETE /api/profile
      // Delete user and profile
      // Private
    
      GET /api/profile/all // Not available yet
      // Get all profiles
    
      GET /api/profile/handle/:handle // Not available yet
      // Get profile by handle
    
  • Post

      POST /api/post
      // Create a new post
      // Private
    
      GET /api/post/all
      // Get all the posts
    
      GET /api/post/:id
      // Get Post by ID
      // Private
    
      DELETE /api/post/:id
      // Delete Post by ID
      // Private
    
      PATCH /api/post/:id
      // Update a post
      // Private
    
  • 本文翻译自下面的链接。 https://medium.freecodecamp.org/rest-is-the-new-soap-97ff6c09896d REST is the new SOAP REST是新的SOAP(Simple Object Access Protocol) Written by Pascal Chambon, reviewed by Rapha?l Gomès 作者Pas

  • soap rest Written by Pascal Chambon, reviewed by Raphaël Gomès 由Pascal Chambon撰写,由RaphaëlGomès评论 Update: this article mostly deals with the RESTish ecosystem, which now constitutes a major part of web

 相关资料
  • express-rest-api-boilerplate Express REST API with JWT Authentication and support for sqlite, mysql, and postgresql authentication via JWT routes mapping via express-routes-mapper support for sqlite,

  • Koa REST API Boilerplate Boilerplate for Node.js Koa RESTful API application with Docker, Swagger, Jest, CodeCov, and Circle CI Koa REST API Boilerplate is a highly opinionated boilerplate template fo

  • express-mongodb-rest-api-boilerplate Also express-graphql-mongodb-boilerplate - GraphQL API Boilerplate Authentication from scratch Sign In, Sign Up, Reset Password, Change Password, Update User E-mai

  • RESTful API using Node.js, Express, Mongoose & TypeScript This is a boilerplate for building scalable and robust REST APIs using Node.js & TypeScript. Table of Contents Prerequisites Features Getting

  • Express ES2017 REST API Boilerplate Boilerplate/Generator/Starter Project for building RESTful APIs and microservices using Node.js, Express and MongoDB Features No transpilers, just vanilla javascrip

  • A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular. �� Description This boilerplate is made to quickly prototype backend applicat