Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
nodejs-60-2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nontawat kanboon
nodejs-60-2
Commits
2671163a
Commit
2671163a
authored
Apr 04, 2018
by
nontawat kanboon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push สำเร็จ
parent
b2500999
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
186 additions
and
0 deletions
+186
-0
.server.js.swp
week10-11/crudwebapp/.server.js.swp
+0
-0
custom.min.css
week10-11/crudwebapp/custom.min.css
+0
-0
index.html
week10-11/crudwebapp/index.html
+123
-0
package-lock.json
week10-11/crudwebapp/package-lock.json
+0
-0
package.json
week10-11/crudwebapp/package.json
+28
-0
server.js
week10-11/crudwebapp/server.js
+35
-0
No files found.
week10-11/crudwebapp/.server.js.swp
0 → 100644
View file @
2671163a
File added
week10-11/crudwebapp/custom.min.css
0 → 100644
View file @
2671163a
week10-11/crudwebapp/index.html
0 → 100644
View file @
2671163a
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"msapplication-tap-highlight"
content=
"no"
>
<meta
name=
"description"
content=
"Materialize is a Material Design Admin Template,It's modern, responsive and based on Material Design by Google. "
>
<meta
name=
"keywords"
content=
"materialize, admin template, dashboard template, flat admin template, responsive admin template,"
>
<title>
Login Page | Materialize - Material Design Admin Template
</title>
<!-- Favicons-->
<link
rel=
"icon"
href=
"images/favicon/favicon-32x32.png"
sizes=
"32x32"
>
<!-- Favicons-->
<link
rel=
"apple-touch-icon-precomposed"
href=
"images/favicon/apple-touch-icon-152x152.png"
>
<!-- For iPhone -->
<meta
name=
"msapplication-TileColor"
content=
"#00bcd4"
>
<meta
name=
"msapplication-TileImage"
content=
"images/favicon/mstile-144x144.png"
>
<!-- For Windows Phone -->
<!-- CORE CSS-->
<link
href=
"css/materialize.min.css"
type=
"text/css"
rel=
"stylesheet"
media=
"screen,projection"
>
<link
href=
"css/style.min.css"
type=
"text/css"
rel=
"stylesheet"
media=
"screen,projection"
>
<!-- Custome CSS-->
<link
href=
"http://demo.geekslabs.com/materialize-v1.0/css/custom/custom.min.css"
type=
"text/css"
rel=
"stylesheet"
media=
"screen,projection"
>
<link
href=
"http://demo.geekslabs.com/materialize-v1.0/css/layouts/page-center.css"
type=
"text/css"
rel=
"stylesheet"
media=
"screen,projection"
>
<!-- Compiled and minified CSS -->
<link
rel=
"stylesheet"
href=
"https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css"
>
<!-- Compiled and minified JavaScript -->
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/js/materialize.min.js"
></script>
<!-- INCLUDED PLUGIN CSS ON THIS PAGE -->
<link
href=
"http://demo.geekslabs.com/materialize-v1.0/js/plugins/prism/prism.css"
type=
"text/css"
rel=
"stylesheet"
media=
"screen,projection"
>
<link
href=
"http://demo.geekslabs.com/materialize-v1.0/js/plugins/perfect-scrollbar/perfect-scrollbar.css"
type=
"text/css"
rel=
"stylesheet"
media=
"screen,projection"
>
</head>
<body
class=
"cyan"
>
<!-- Start Page Loading -->
<div
id=
"loader-wrapper"
>
<div
id=
"loader"
></div>
<div
class=
"loader-section section-left"
></div>
<div
class=
"loader-section section-right"
></div>
</div>
<!-- End Page Loading -->
<div
id=
"login-page"
class=
"row"
>
<div
class=
"col s12 z-depth-4 card-panel"
>
<form
class=
"login-form"
action=
"/quotes"
method=
"POST"
>
<div
class=
"row"
>
<div
class=
"input-field col s12 center"
>
<img
src=
"http://demo.geekslabs.com/materialize-v1.0/images/login-logo.png"
alt=
""
class=
"circle responsive-img valign profile-image-login"
>
<p
class=
"center login-form-text"
>
Material Design Admin Template
</p>
</div>
</div>
<div
class=
"row margin"
>
<div
class=
"input-field col s12"
>
<i
class=
"mdi-social-person-outline prefix"
></i>
<input
id=
"name"
type=
"text"
name=
"name"
>
<label
for=
"name"
class=
"center-align"
>
Name
</label>
</div>
</div>
<div
class=
"row margin"
>
<div
class=
"input-field col s12"
>
<i
class=
"mdi-action-lock-outline prefix"
></i>
<input
id=
"quote"
type=
"text"
name=
"quote"
>
<label
for=
"quote"
>
Quote
</label>
</div>
</div>
<div
class=
"row"
>
<div
class=
"input-field col s12 m12 l12 login-text"
>
<input
type=
"checkbox"
id=
"remember-me"
/>
<label
for=
"remember-me"
>
Remember me
</label>
</div>
</div>
<div
class=
"row"
>
<div
class=
"input-field col s12"
>
<button
type=
"submit"
class=
"btn waves-effect waves-light col s12"
>
Login
</button>
</div>
</div>
<div
class=
"row"
>
<div
class=
"input-field col s6 m6 l6"
>
<p
class=
"margin medium-small"
><a
href=
"page-register.html"
>
Register Now!
</a></p>
</div>
<div
class=
"input-field col s6 m6 l6"
>
<p
class=
"margin right-align medium-small"
><a
href=
"page-forgot-password.html"
>
Forgot password ?
</a></p>
</div>
</div>
</form>
</div>
</div>
<!-- ================================================
Scripts
================================================ -->
<!-- jQuery Library -->
<script
type=
"text/javascript"
src=
"js/plugins/jquery-1.11.2.min.js"
></script>
<!--materialize js-->
<script
type=
"text/javascript"
src=
"js/materialize.min.js"
></script>
<!--prism-->
<script
type=
"text/javascript"
src=
"js/plugins/prism/prism.js"
></script>
<!--scrollbar-->
<script
type=
"text/javascript"
src=
"js/plugins/perfect-scrollbar/perfect-scrollbar.min.js"
></script>
<!--plugins.js - Some Specific JS codes for Plugin Settings-->
<script
type=
"text/javascript"
src=
"js/plugins.min.js"
></script>
<!--custom-script.js - Add your own theme custom JS-->
<script
type=
"text/javascript"
src=
"js/custom-script.js"
></script>
</body>
</html>
week10-11/crudwebapp/package-lock.json
0 → 100644
View file @
2671163a
This diff is collapsed.
Click to expand it.
week10-11/crudwebapp/package.json
0 → 100644
View file @
2671163a
{
"name"
:
"crudwebapp"
,
"version"
:
"0.1.0"
,
"description"
:
"crud application to mongodb through expressjs"
,
"main"
:
"server.js"
,
"scripts"
:
{
"start"
:
"nodemon server.js"
,
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"repository"
:
{
"type"
:
"git"
,
"url"
:
"http://projectcs.sci.ubu.ac.th/nontawatkb/nodejs-60-2"
},
"keywords"
:
[
"CRUD"
,
"mongodb"
,
"expressjs"
,
"ubu"
,
"comsci"
],
"author"
:
"nontawat.kanboon"
,
"license"
:
"ISC"
,
"dependencies"
:
{
"body-parser"
:
"^1.18.2"
,
"express"
:
"^4.16.3"
,
"mongodb"
:
"^3.0.5"
}
}
week10-11/crudwebapp/server.js
0 → 100644
View file @
2671163a
const
express
=
require
(
'express'
);
const
parser
=
require
(
'body-parser'
);
const
app
=
express
();
const
mongodb
=
require
(
'mongodb'
)
const
client
=
mongodb
.
MongoClient
;
var
url
=
"mongodb://localhost:27017/crudwebappdb"
;
app
.
use
(
parser
.
urlencoded
({
extended
:
true
}))
app
.
get
(
'/test'
,
(
req
,
res
)
=>
{
res
.
send
(
'Test Test'
);
});
client
.
connect
(
url
,
(
err
,
con
)
=>
{
if
(
err
)
throw
err
;
console
.
log
(
"Database ชื่อ crudwebappdb สร้างแล้วเด้อ!"
);
app
.
get
(
'/'
,
(
req
,
res
)
=>
{
console
.
log
(
db
.
collection
(
'quotes'
).
find
());
res
.
sendFile
(
__dirname
+
'/index.html'
);
});
let
db
=
con
.
db
(
'crudwebappdb'
);
app
.
post
(
'/quotes'
,
(
req
,
res
)
=>
{
console
.
log
(
req
.
body
);
db
.
collection
(
'quotes'
).
insertOne
(
req
.
body
,
(
err
,
result
)
=>
{
if
(
err
)
return
console
.
log
(
err
)
console
.
log
(
`บันทึก
${
req
.
body
}
ไปที่ database แล้ว`
)
res
.
redirect
(
'/'
)
})
});
app
.
listen
(
8000
,
function
()
{
console
.
log
(
"เริ่มละนะ "
);
});
//con.close();
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment