Skip to content

Commit b72e1d0

Browse files
committed
unprotects routes
1 parent 1d42edb commit b72e1d0

File tree

8 files changed

+831
-332
lines changed

8 files changed

+831
-332
lines changed

api/routes/posts-router.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ router.get('/:id', async (req, res) => {
4343

4444
// returns created post and all posts
4545

46-
router.post('/', authHelper.protected, async (req, res) => {
46+
router.post('/', async (req, res) => {
4747
let { id, ...newPost } = req.body
4848
console.log(req.body);
4949

@@ -63,7 +63,7 @@ router.post('/', authHelper.protected, async (req, res) => {
6363

6464
/* ========== PUT =========== */
6565

66-
router.put('/:id', authHelper.protected, async (req, res) => {
66+
router.put('/:id', async (req, res) => {
6767
const { id } = req.params
6868
const changes = req.body;
6969
try {
@@ -90,7 +90,7 @@ router.put('/:id', authHelper.protected, async (req, res) => {
9090

9191
/* ========== DELETE =========== */
9292

93-
router.delete('/:id', authHelper.protected, async (req, res) => {
93+
router.delete('/:id', async (req, res) => {
9494
const { id } = req.params;
9595
try {
9696
const del_post_categories = await db('post-categories').where({post_id:id}).del()

database/dbConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ require('dotenv').config();
22

33
const knex = require('knex');
44
const knexConfig = require('../knexfile.js');
5-
const environment = process.env.ENVIRONMENT || 'production';
5+
const environment = process.env.ENVIRONMENT || 'development';
66
const db = knex(knexConfig[environment])
77

88
module.exports = db;

database/howtodb.sqlite3

-48 KB
Binary file not shown.

database/seeds/001-posts.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
const faker = require('faker');
22

33
exports.seed = function(knex, Promise) {
4-
// Deletes ALL existing entries
5-
return knex('posts').delete()
6-
.then(function () {
7-
// Inserts seed entries
4+
//// Deletes ALL existing entries
5+
// return knex('posts').delete()
6+
// .then(function () {
7+
// // Inserts seed entries
88
return knex('posts').insert([
99
{
1010
title: "How to sign up for Lambda School",
@@ -25,5 +25,5 @@ exports.seed = function(knex, Promise) {
2525
creator_id: 1
2626
},
2727
]);
28-
});
28+
// });
2929
};

database/seeds/002-categories.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
exports.seed = function(knex, Promise) {
3-
return knex('categories').delete()
4-
.then(function () {
3+
// return knex('categories').delete()
4+
// .then(function () {
55
// Inserts seed entries
66
return knex('categories').insert([
77
{
@@ -17,5 +17,5 @@ exports.seed = function(knex, Promise) {
1717
category_name: "Javascript"
1818
}
1919
]);
20-
});
20+
// });
2121
};

database/seeds/003-add_posts_categories.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22
exports.seed = function(knex, Promise) {
33
// Deletes ALL existing entries
4-
return knex('post-categories').delete()
5-
.then(function () {
6-
// Inserts seed entries
4+
// return knex('post-categories').delete()
5+
// .then(function () {
6+
// // Inserts seed entries
77
return knex('post-categories').insert([
88
{
99
post_id: 1,
@@ -22,5 +22,5 @@ exports.seed = function(knex, Promise) {
2222
category_id: 4
2323
},
2424
]);
25-
});
25+
// });
2626
};

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
"jsonwebtoken": "^8.5.0",
3030
"knex": "^0.19.5",
3131
"knex-cleaner": "^1.1.4",
32+
"node-gyp": "^9.2.0",
3233
"pg": "^7.8.2",
33-
"sqlite3": "^4.0.6"
34+
"sqlite3": "^5.1.2"
3435
},
3536
"devDependencies": {
3637
"nodemon": "^1.18.10"

0 commit comments

Comments
 (0)