Skip to content

Instantly share code, notes, and snippets.

View topspinppy's full-sized avatar
🏠
Working from home

topspinppy

🏠
Working from home
  • Information Technology, KMUTNB Prachinburi Campus
View GitHub Profile
add $s0 , $s1 , $s2
//เอา $s1 + $s2
add $s0 , $s1 , $s2
//เอา $s1 + $s2
1 2,3,4
| 1 = คำสั่งนี้ทำงานอะไร
| 2 = ใช้เก็บผลลัพธ์
| 3 = ตัวแปรที่ 1
| 4 = ตัวแปรที่ 2
$ 16 - $ 23 => $s0 - $s7
"ทำหน้าที่เป็นตัวแปร (variable)"
$ 8 - $ 15 => $t0 - $t7
"ทำหน้าที่เป็นตัวแปรชั่วคราว (temporary variable)"
sudo rm /var/lib/apt/lists/lock
var express = require("express");
var app = express();
const mongoose = require("mongoose");
/////////////////////////////////// เพิ่มส่วนนี้ ////////////////////////////////////
const connect = `mongodb://${process.env.DATABASE_USER}:${
process.env.DATABASE_PASSWORD
}@${process.env.DATABASE_HOST}:27017/shoppers?authSource=admin`;
mongoose.connect(connect, { useNewUrlParser: true });
db.createCollection("student");
db.student.insert({
id: 1,
Name: "สมชาย",
Surname: "เข็มกลัด",
thumbnail: "/images/student/somchai.jpg"
});
db.student.insert({
id: 2,
Name: "วิชชุดา",
FROM mongo:3.4.7
#FROM : อ้างอิงถึง parent image ชื่อ mongo ติด tag version 3.4.7
ENV MONGO_INITDB_ROOT_USERNAME admin
ENV MONGO_INITDB_ROOT_PASSWORD 1234
ENV MONGO_INITDB_DATABASE shoppers
# กำหนด ENV ให้มัน
#กรณีที่ต้องการ Set initial db ให้มัน
ADD ./data/datastudent.js /docker-entrypoint-initdb.d
@topspinppy
topspinppy / run
Last active March 18, 2019 16:25
docker run -p 2000:4000 apitestserver:1.0