Created
July 15, 2020 09:12
-
-
Save dkotama/bfa9f20bae65c9df81ca28a0bf67b6cf to your computer and use it in GitHub Desktop.
server.js buat kak ferdy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const cors = require('cors'); | |
const http = require('http').createServer(app); | |
const path = require('path'); | |
// setup cors | |
app.use(cors()); | |
// serve static files | |
app.use('/public', express.static(path.join(__dirname, 'public'))); | |
// start server | |
http.listen(3000, function() { | |
console.log('Server started!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Setelah buat server.js ini run di command line
npm install -d nodemon
tunggu , lalu install
npm install --save cors express
kira kira package json akan terlihat seperti ini
letakkan semua file html & js nya di folder
/public
jadi strukturnya