Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frankfang/nextjs-typeorm-show-posts
https://github.com/frankfang/nextjs-typeorm-show-posts
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/frankfang/nextjs-typeorm-show-posts
- Owner: FrankFang
- Created: 2020-06-10T09:57:42.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T08:30:26.000Z (almost 2 years ago)
- Last Synced: 2024-04-17T00:07:40.930Z (7 months ago)
- Language: TypeScript
- Size: 1.34 MB
- Stars: 2
- Watchers: 3
- Forks: 5
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 初始代码
## 启动数据库
```
mkdir blog-data
docker run -v "$PWD/blog-data":/var/lib/postgresql/data -p 5432:5432 -e POSTGRES_USER=blog -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:12.2或者旧版 Windows Docker 客户端运行下面的代码
docker run -v "blog-data":/var/lib/postgresql/data -p 5432:5432 -e POSTGRES_USER=blog -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:12.2
```
## 清空之前的开发环境
```
docker ps
docker kill 容器id
docker rm 容器idrm -rf blog-data
或
docker container prune
docker volume rm blog-data```
## 创建数据库
```
docker exec -it bash
psql -U blog
CREATE DATABASE blog_development ENCODING 'UTF8' LC_COLLATE 'en_US.utf8' LC_CTYPE 'en_US.utf8';
```## 数据表
首先修改 ormconfig.json 中的 host,然后运行
```
yarn m:run
node dist/seed.js
```## 开发
```bash
yarn dev
# or
npm run dev
```## 部署
```bash
yarn build
yarn start
```