jianboy 1 year ago
parent
commit
35d95ad81f
9 changed files with 81 additions and 2 deletions
  1. 15 0
      Dockerfile
  2. 7 0
      README.md
  3. 0 0
      components/button.js
  4. 10 1
      docs/Summary.md
  5. 1 1
      package.json
  6. 1 0
      pages/_app.js
  7. 9 0
      pages/api/hello.js
  8. 26 0
      pages/posts/first-post.js
  9. 12 0
      pm2.json

+ 15 - 0
Dockerfile

@@ -0,0 +1,15 @@
+FROM node:16.16.0
+WORKDIR /app
+# 时区
+ENV TZ=Asia/Shanghai \
+    DEBIAN_FRONTEND=noninteractive
+RUN ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
+
+# npm 源,选用国内镜像源以提高下载速度
+#RUN npm config set registry https://mirrors.cloud.tencent.com/npm/
+
+COPY . /app
+RUN npm install --only=production
+
+CMD ["npm", "start"]
+ENTRYPOINT [ "npm", "start" ]

+ 7 - 0
README.md

@@ -39,3 +39,10 @@ You can check out [the Next.js GitHub repository](https://github.com/vercel/next
 The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
 
 Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
+
+
+# pm2 守护进程
+
+pm2 start pm2.json
+
+

+ 0 - 0
components/button.js


+ 10 - 1
docs/Summary.md

@@ -32,4 +32,13 @@ date: 2023-05-02 12:00:00
     * [关于我们](other/about_us.md)
 	* [常见问题](other/questions.md)
 	* [商务合作](other/coor.md)
-	
+	
+
+	数据库
+
+	npm install mongodb
+	mysql
+	
+	消息队列
+
+	npm install -S amqplib

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "nextjs-demo",
   "description": "nextjs demo",
-  "version": "0.1.0",
+  "version": "1.1.0",
   "private": true,
   "scripts": {
     "dev": "next dev",

+ 1 - 0
pages/_app.js

@@ -1,4 +1,5 @@
 import '../styles/globals.css'
+import Head from 'next/head'
 
 function MyApp({ Component, pageProps }) {
   return <Component {...pageProps} />

+ 9 - 0
pages/api/hello.js

@@ -1,4 +1,13 @@
 // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
+import type {NextApiRequest, NextApiResponse} from "next";
+
+// import { MongoClient, Db, MongoClientOption }from "mongodb";
+
+const cfg = {
+  url: "mongodb://root:mongodb.rds.aliyuncs.com:3717",
+  name: "admin"
+}
+
 
 export default function handler(req, res) {
   res.status(200).json({ name: 'John Doe' })

+ 26 - 0
pages/posts/first-post.js

@@ -0,0 +1,26 @@
+/** visit to : http://localhost:7433/posts/first-post
+* @Description: default
+* @Date: 2023年09月13日 Wednesday
+* @Author liuyuqi.gov@msn.
+*/
+
+import Link from 'next/link'
+import Head from 'next/head';
+
+export default function FirstPost() {
+    return (
+    <>
+    <Head>
+        <title>First Post</title>
+    </Head>
+      <h1>First Post</h1>
+      <h2>
+        <Link href="/">
+          <a>Back to home</a>
+          {/* <img src="/vercel.svg" alt="Vercel Logo" className="logo" /> */}
+
+        </Link>
+      </h2>
+    </>
+  );
+}

+ 12 - 0
pm2.json

@@ -0,0 +1,12 @@
+{
+    "apps": [
+        {
+            "name": "nextjs-note@8082",
+            "script": "index.js",
+            "args": [],
+            "env": {
+                "PORT": "8082"
+            }
+        }
+    ]
+}