Skip to content

Commit

Permalink
Merge pull request #1 from manojthetechguy/deploy-code
Browse files Browse the repository at this point in the history
Deploy code on heroku
  • Loading branch information
manojd929 authored Jul 24, 2023
2 parents 2bd6a4b + 16c081a commit aa41b27
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "moviebizz app",
"main": "index.js",
"scripts": {
"start": "node server.js | npm run rest-server",
"rest-server": "json-server --port 4010 --watch rest-db/data.json"
"start": "node server.js"
},
"author": "manojd929",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion public/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function ajaxRequest(callback, resource) {
// depending on the query params, constructs url and returns to ajaxRequest function
function urlGenerator(resource) {
// default url to call
var url = 'http://localhost:4010/';
var url = 'https://moviebizz.herokuapp.com/';
if (resource !== undefined) {
url += 'info';
return url;
Expand Down
15 changes: 8 additions & 7 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const express = require('express');
const app = express();
const jsonServer = require('json-server');
const server = jsonServer.create();
const router = jsonServer.router('./rest-db/data.json');
const middlewares = jsonServer.defaults();
const port = process.env.PORT || 4010;

app.use(express.static('public'));
server.use(middlewares);
server.use(router);

const PORT = 4000 || process.env.PORT;
app.listen(PORT, () => {
console.log(`Server Started listening at port ${PORT}...`)
});
server.listen(port);

0 comments on commit aa41b27

Please sign in to comment.