Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/layouwen/nodejs-blog
nodejs blog server. nodejs 博客服务端。
https://github.com/layouwen/nodejs-blog
Last synced: 2 days ago
JSON representation
nodejs blog server. nodejs 博客服务端。
- Host: GitHub
- URL: https://github.com/layouwen/nodejs-blog
- Owner: Layouwen
- Created: 2020-12-29T16:22:48.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-14T07:44:06.000Z (3 months ago)
- Last Synced: 2024-08-14T08:25:42.352Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 413 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nodejs Blog
English | [简体中文](./README.zh-CN.md)
## Introduction
This project is intended for learning how to build a blog backend service using native Node.js or with the help of frameworks like Express or Koa2, in combination with MySQL or MongoDB databases.
## Branches
Different branches correspond to different learning topics. The default port for the server is 8080.
For example:
POST `http://localhost:8080/api/user/login`
BODY `{ "username": "layouwen", "password": "layouwen" }`### master
Implementation using native Node.js with MySQL query string concatenation.
- Configure the `mysql` and `redis` parameters in `src/conf/db.js`.
- Create the database and tables using `init.sql`.
- Install dependencies with `npm install`.
- Start the service with `npm run dev`.### express
Implementation using Express with MySQL query string concatenation.
- Navigate to the `blog-express` directory.
- Configure the `mysql` and `redis` parameters in `conf/db.js`.
- Create the database and tables using `init.sql`.
- Install dependencies with `npm install`.
- Start the service with `npm run dev`.### koa2
Implementation using Koa2 with MySQL query string concatenation.
- Navigate to the `blog-koa2` directory.
- Configure the `mysql` and `redis` parameters in `conf/db.js`.
- Create the database and tables using `init.sql`.
- Install dependencies with `npm install`.
- Start the service with `npm run dev`.### mongoose
Implementation using Koa2 with MongoDB.
- Navigate to the `blog-mongoose` directory.
- Configure the `mongodb` parameters in `db/db.js`.
- After connecting to the database with `mongodb-compass`, create a document in the `user` collection: `{ "username": "layouwen", "password": "c6657f3bd287f6092c91a759ca3f5011" }`.
- Install dependencies with `npm install`.
- Start the service with `npm run dev`.